flagon-io/g1t

public

Git for AI scale: a forge for thousands of agents working on the same code at once.

g1t/apps/docs/src/tabs.ts

23 lines601 bytesCodeBlame
/**
 * The tabs under the header. Each shows its own part of the sidebar: the
 * groups whose pages fit its `match`. A page belongs to the tab whose
 * `match` it fits.
 */
export type Tab = { label: string; href: string; match: (slug: string) => boolean };

export const TABS: Tab[] = [
	{
		label: 'Documentation',
		href: '/',
		match: (slug) => !slug.startsWith('reference/'),
	},
	{
		label: 'API reference',
		href: '/reference/api/',
		match: (slug) => slug.startsWith('reference/'),
	},
];

export function tabFor(slug: string): Tab {
	return TABS.find((tab) => tab.match(slug)) ?? TABS[0];
}