import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { SectionHeading } from "@/components/ui/section-heading" import { ComponentContainer } from "@/components/ui/component-container" export function TabsSection() { const tabsProperties = [ { name: "size", type: "select" as const, options: ["default", "small"], defaultValue: "default", label: "Size", description: "Size of the tabs", }, { name: "variant", type: "select" as const, options: ["default", "underline", "pills"], defaultValue: "default", label: "Variant", description: "Visual style of the tabs", }, { name: "orientation", type: "select" as const, options: ["horizontal", "vertical"], defaultValue: "horizontal", label: "Orientation", description: "Layout direction of the tabs", }, { name: "fullWidth", type: "boolean" as const, defaultValue: false, label: "Full Width", description: "Make tabs span full width", }, ] const renderTabs = (props: Record) => { const { size, variant, orientation, fullWidth } = props const getTabsListClasses = () => { let classes = "" if (orientation === "vertical") { classes += "flex-col h-auto" } else { classes += "inline-flex h-10 items-center justify-center" } if (variant === "default") { classes += " rounded-md bg-[var(--background-secondary)] p-1 text-muted-foreground" } else if (variant === "underline") { classes += " w-full justify-start border-b rounded-none bg-transparent p-0" } else if (variant === "pills") { classes += " gap-2 bg-transparent" } if (fullWidth && orientation === "horizontal" && variant === "default") { classes += " grid grid-cols-3 w-full" } if (size === "small") { classes = classes.replace("h-10", "h-8") } return classes } const getTabsTriggerClasses = () => { let classes = "inline-flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" if (size === "small") { classes += " text-xs px-2 py-1" } else { classes += " text-sm px-3 py-1.5" } if (variant === "default") { // Revert to default shadcn styling } else if (variant === "underline") { if (size === "small") { classes += " h-8 px-3 pb-1 pt-2 rounded-none border-b-2 border-b-transparent bg-transparent text-muted-foreground shadow-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none" } else { classes += " h-9 px-4 pb-2 pt-2 rounded-none border-b-2 border-b-transparent bg-transparent text-muted-foreground shadow-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none" } } else if (variant === "pills") { if (size === "small") { classes += " h-6 rounded-full px-3 bg-[var(--background-secondary)] data-[state=active]:bg-primary data-[state=active]:text-primary-foreground" } else { classes += " h-9 rounded-full px-4 bg-[var(--background-secondary)] data-[state=active]:bg-primary data-[state=active]:text-primary-foreground" } } if (orientation === "vertical") { classes += " justify-start w-full" } return classes } const containerClasses = orientation === "vertical" ? "flex gap-4" : "w-full" return ( {size === "small" ? "Tab 1" : "Dashboard"} {size === "small" ? "Tab 2" : "Analytics"} {size === "small" ? "Tab 3" : "Reports"}
{size === "small" ? "Content 1" : "Dashboard content goes here."}
{size === "small" ? "Content 2" : "Analytics content goes here."}
{size === "small" ? "Content 3" : "Reports content goes here."}
) } const generateCode = (props: Record) => { const { size, variant, orientation, fullWidth } = props const getTabsListClasses = () => { let classes = "" if (orientation === "vertical") { classes += "flex-col h-auto" } else { classes += "inline-flex h-10 items-center justify-center" } if (variant === "default") { classes += " rounded-md bg-[var(--background-secondary)] p-1 text-muted-foreground" } else if (variant === "underline") { classes += " w-full justify-start border-b rounded-none bg-transparent p-0" } else if (variant === "pills") { classes += " gap-2 bg-transparent" } if (fullWidth && orientation === "horizontal" && variant === "default") { classes += " grid grid-cols-3 w-full" } if (size === "small") { classes = classes.replace("h-10", "h-8") } return classes } const getTabsTriggerClasses = () => { let classes = "inline-flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" if (size === "small") { classes += " text-xs px-2 py-1" } else { classes += " text-sm px-3 py-1.5" } if (variant === "default") { // Revert to default shadcn styling } else if (variant === "underline") { if (size === "small") { classes += " h-8 px-3 pb-1 pt-2 rounded-none border-b-2 border-b-transparent bg-transparent text-muted-foreground shadow-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none" } else { classes += " h-9 px-4 pb-2 pt-2 rounded-none border-b-2 border-b-transparent bg-transparent text-muted-foreground shadow-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none" } } else if (variant === "pills") { if (size === "small") { classes += " h-6 rounded-full px-3 bg-[var(--background-secondary)] data-[state=active]:bg-primary data-[state=active]:text-primary-foreground" } else { classes += " h-9 rounded-full px-4 bg-[var(--background-secondary)] data-[state=active]:bg-primary data-[state=active]:text-primary-foreground" } } if (orientation === "vertical") { classes += " justify-start w-full" } return classes } const containerClasses = orientation === "vertical" ? "flex gap-4" : "w-full" const tabsListClasses = getTabsListClasses() const tabsTriggerClasses = getTabsTriggerClasses() return ` ${size === "small" ? "Tab 1" : "Dashboard"} ${size === "small" ? "Tab 2" : "Analytics"} ${size === "small" ? "Tab 3" : "Reports"} ${orientation === "vertical" ? '
' : ""}
${size === "small" ? "Content 1" : "Dashboard content goes here."}
${size === "small" ? "Content 2" : "Analytics content goes here."}
${size === "small" ? "Content 3" : "Reports content goes here."}
${orientation === "vertical" ? "
" : ""}
` } return (
Account Password Settings
Account settings content goes here.
Password settings content goes here.
Other settings content goes here.
`} > Account Password Settings
Account settings content goes here.
Password settings content goes here.
Other settings content goes here.
Tab 1 Tab 2 Tab 3
Content 1
Content 2
Content 3
`} > Tab 1 Tab 2 Tab 3
Content 1
Content 2
Content 3
Profile Notifications Appearance
Profile settings content goes here.
Notification settings content goes here.
Appearance settings content goes here.
`} > Profile Notifications Appearance
Profile settings content goes here.
Notification settings content goes here.
Appearance settings content goes here.
Tab 1 Tab 2 Tab 3
Tab 1 content goes here.
Tab 2 content goes here.
Tab 3 content goes here.
`} > Tab 1 Tab 2 Tab 3
Tab 1 content goes here.
Tab 2 content goes here.
Tab 3 content goes here.
Dashboard Analytics Reports
Dashboard content goes here.
Analytics content goes here.
Reports content goes here.
`} > Dashboard Analytics Reports
Dashboard content goes here.
Analytics content goes here.
Reports content goes here.
) }