PositionTabs.tsx 1.47 KB
import type { PositionTab } from '../types/home';

export interface PositionTabsProps {
  tabs: PositionTab[];
  currentIndex: number;
  onChange: (index: number) => void;
}

export function PositionTabs({ tabs, currentIndex, onChange }: PositionTabsProps) {
  if (tabs.length === 0) {
    return null;
  }

  return (
    <nav className="bg-surface py-stack-sm tablet:py-stack-md">
      <div className="text-center px-margin-mobile tablet:px-margin-desktop mb-stack-sm tablet:mb-12">
        <h2 className="text-headline-sm tablet:text-headline-md mb-2">
          广联岗位 <span className="text-primary-container">Agent</span>
        </h2>
        <p className="text-body-md text-on-surface-variant">让数字员工融入组织,让岗位焕发智能生产力</p>
      </div>

      <div className="flex flex-wrap justify-center gap-2 mb-16 p-1.5 bg-surface-container rounded-2xl max-w-fit mx-auto overflow-hidden tablet:overflow-x-auto tablet:no-scrollbar">
        {tabs.map((tab, index) => (
          <button
            key={tab.tab_id}
            onClick={() => onChange(index)}
            className={`whitespace-nowrap px-6 py-2.5 rounded-xl text-label-md transition-all ${
              index === currentIndex
                ? 'bg-primary-container text-on-primary'
                : 'bg-surface-container text-on-surface-variant hover:bg-surface-variant/50'
            }`}
          >
            {tab.position_name}
          </button>
        ))}
      </div>
    </nav>
  );
}