Files
box-box/frontend/src/components/TabBar.tsx

44 lines
984 B
TypeScript
Raw Normal View History

2026-05-25 02:56:06 -04:00
export type Tab =
| 'results'
| 'grid'
| 'strategy'
| 'positions'
| 'laps'
| 'race_control'
| 'weather'
| 'datasets'
2026-05-25 01:20:04 -04:00
const TABS: { id: Tab; label: string }[] = [
{ id: 'results', label: 'Results' },
{ id: 'grid', label: 'Grid' },
{ id: 'strategy', label: 'Strategy' },
{ id: 'positions', label: 'Positions' },
2026-05-25 02:56:06 -04:00
{ id: 'laps', label: 'Laps' },
{ id: 'race_control', label: 'Race Control' },
{ id: 'weather', label: 'Weather' },
2026-05-25 01:20:04 -04:00
{ id: 'datasets', label: 'Datasets' },
]
interface Props {
active: Tab
onChange: (tab: Tab) => void
}
export function TabBar({ active, onChange }: Props) {
return (
<div className="tab-bar" role="tablist">
{TABS.map((t) => (
<button
key={t.id}
role="tab"
aria-selected={active === t.id}
className={`tab-btn${active === t.id ? ' active' : ''}`}
onClick={() => onChange(t.id)}
>
{t.label}
</button>
))}
</div>
)
}