pr_01m47d24b0e6n91zwymwxg0vpx/apps/docs/src/tabs.ts

24 lines719 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Docs in the shape of docs.continue.dev1/**
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 */
5export type Tab = { label: string; href: string; groups: string[]; match: (slug: string) => boolean };
6
7export 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
22export function tabFor(slug: string): Tab {
23 return TABS.find((tab) => tab.match(slug)) ?? TABS[0];
24}