forked from OurHike/OurHike
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabBar.tsx
More file actions
30 lines (27 loc) · 827 Bytes
/
Copy pathTabBar.tsx
File metadata and controls
30 lines (27 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Trail / Downloads / More (WIREFRAMES.md §6). The tab set itself lives in
// tabs.ts - see the note there.
import { TABS, type TabId } from './tabs'
export interface TabBarProps {
active: TabId
onSelect: (id: TabId) => void
}
export function TabBar({ active, onSelect }: TabBarProps) {
return (
<nav className="tab-bar" role="tablist" aria-label="Main">
{TABS.map((tab) => (
<button
key={tab.id}
type="button"
role="tab"
className="tab-bar__tab"
aria-selected={tab.id === active}
// Fires even when already active, so the screen can scroll to top -
// the standard tab-bar affordance people already expect.
onClick={() => onSelect(tab.id)}
>
{tab.label}
</button>
))}
</nav>
)
}