pr_01m47d15m3e54sn21z27rpy5n9/apps/docs/src/tabs.ts
| 1 | /** |
| 2 | * The tabs under the header. Each shows its own part of the sidebar, as |
| 3 | * the groups named here; a page belongs to the tab whose `match` it fits. |
| 4 | */ |
| 5 | export type Tab = { label: string; href: string; groups: string[]; match: (slug: string) => boolean }; |
| 6 | |
| 7 | export const TABS: Tab[] = [ |
| 8 | { |
| 9 | label: 'Documentation', |
| 10 | href: '/', |
| 11 | groups: ['Get started', 'Agents', 'Connect your tools', 'Landing changes', 'Workspaces'], |
| 12 | match: (slug) => !slug.startsWith('reference/'), |
| 13 | }, |
| 14 | { |
| 15 | label: 'API reference', |
| 16 | href: '/reference/api/', |
| 17 | groups: ['Reference'], |
| 18 | match: (slug) => slug.startsWith('reference/'), |
| 19 | }, |
| 20 | ]; |
| 21 | |
| 22 | export function tabFor(slug: string): Tab { |
| 23 | return TABS.find((tab) => tab.match(slug)) ?? TABS[0]; |
| 24 | } |