g1t/apps/web/app/components/ui/tabs.tsx
| 1 | import { Tabs as Primitive } from "radix-ui"; |
| 2 | import type { ComponentProps } from "react"; |
| 3 | |
| 4 | import { cn } from "../../lib/cn"; |
| 5 | |
| 6 | // shadcn/ui's tabs, styled with g1t's tokens. |
| 7 | |
| 8 | export const Tabs = Primitive.Root; |
| 9 | |
| 10 | export function TabsList({ |
| 11 | className, |
| 12 | ...props |
| 13 | }: ComponentProps<typeof Primitive.List>) { |
| 14 | return ( |
| 15 | <Primitive.List |
| 16 | className={cn( |
| 17 | "inline-flex items-center gap-1 rounded-lg border border-line bg-bg p-1", |
| 18 | className, |
| 19 | )} |
| 20 | {...props} |
| 21 | /> |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | export function TabsTrigger({ |
| 26 | className, |
| 27 | ...props |
| 28 | }: ComponentProps<typeof Primitive.Trigger>) { |
| 29 | return ( |
| 30 | <Primitive.Trigger |
| 31 | className={cn( |
| 32 | "rounded-md px-2.5 py-1 text-xs font-medium text-muted transition-colors outline-none hover:text-fg", |
| 33 | "data-[state=active]:bg-raised data-[state=active]:text-fg", |
| 34 | "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-muted", |
| 35 | className, |
| 36 | )} |
| 37 | {...props} |
| 38 | /> |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | export function TabsContent({ |
| 43 | className, |
| 44 | ...props |
| 45 | }: ComponentProps<typeof Primitive.Content>) { |
| 46 | return ( |
| 47 | <Primitive.Content className={cn("mt-3 outline-none", className)} {...props} /> |
| 48 | ); |
| 49 | } |