import type React from "react"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { Switch } from "@/components/ui/switch"
import { Label } from "@/components/ui/label"
import { Input } from "@/components/ui/input"
import { Separator } from "@/components/ui/separator"
import { Progress } from "@/components/ui/progress"
import { Slider } from "@/components/ui/slider"
import { Textarea } from "@/components/ui/textarea"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
import { ChevronDown } from "lucide-react"
// Define the structure for component variants
export interface ComponentVariant {
id: string
name: string
component: React.ReactNode
}
// Define the structure for component registry
export interface ComponentRegistry {
[key: string]: {
name: string
variants: ComponentVariant[]
}
}
// Create the component registry with variants
export const componentRegistry: ComponentRegistry = {
buttons: {
name: "Button",
variants: [
{
id: "button-primary",
name: "Primary",
component: ,
},
{
id: "button-secondary",
name: "Secondary",
component: ,
},
{
id: "button-outline",
name: "Outline",
component: ,
},
{
id: "button-ghost",
name: "Ghost",
component: ,
},
{
id: "button-destructive",
name: "Destructive",
component: ,
},
{
id: "button-link",
name: "Link",
component: ,
},
],
},
badges: {
name: "Badge",
variants: [
{
id: "badge-default",
name: "Default",
component: Badge,
},
{
id: "badge-secondary",
name: "Secondary",
component: Secondary Badge,
},
{
id: "badge-outline",
name: "Outline",
component: Outline Badge,
},
{
id: "badge-destructive",
name: "Destructive",
component: Destructive Badge,
},
],
},
cards: {
name: "Card",
variants: [
{
id: "card-simple",
name: "Simple",
component: (
This is a simple card with just content.
),
},
{
id: "card-with-header",
name: "With Header",
component: (
Card Title
Card Description
Card content goes here.
),
},
{
id: "card-with-footer",
name: "With Footer",
component: (
Card Title
Card content goes here.
),
},
],
},
checkbox: {
name: "Checkbox",
variants: [
{
id: "checkbox-default",
name: "Default",
component: (
),
},
{
id: "checkbox-disabled",
name: "Disabled",
component: (
),
},
],
},
avatars: {
name: "Avatar",
variants: [
{
id: "avatar-image",
name: "With Image",
component: (
JD
),
},
{
id: "avatar-fallback",
name: "Fallback",
component: (
JD
),
},
],
},
accordion: {
name: "Accordion",
variants: [
{
id: "accordion-single",
name: "Single Item",
component: (
Is it accessible?
Yes. It adheres to the WAI-ARIA design pattern.
),
},
{
id: "accordion-multiple",
name: "Multiple Items",
component: (
Is it accessible?
Yes. It adheres to the WAI-ARIA design pattern.
Is it styled?
Yes. It comes with default styles that matches the other components' aesthetic.
),
},
],
},
alerts: {
name: "Alert",
variants: [
{
id: "alert-default",
name: "Default",
component: (
Heads up!
You can add components to your app using the cli.
),
},
{
id: "alert-destructive",
name: "Destructive",
component: (
Error
Your session has expired. Please log in again.
),
},
],
},
tabs: {
name: "Tabs",
variants: [
{
id: "tabs-default",
name: "Default",
component: (
Account
Password
Make changes to your account here.
Change your password here.
),
},
],
},
switch: {
name: "Switch",
variants: [
{
id: "switch-default",
name: "Default",
component: (
),
},
],
},
input: {
name: "Input",
variants: [
{
id: "input-default",
name: "Default",
component: ,
},
{
id: "input-with-label",
name: "With Label",
component: (
),
},
{
id: "input-disabled",
name: "Disabled",
component: ,
},
],
},
separator: {
name: "Separator",
variants: [
{
id: "separator-horizontal",
name: "Horizontal",
component: (
Content above
Content below
),
},
{
id: "separator-vertical",
name: "Vertical",
component: (
Content left
Content right
),
},
],
},
progress: {
name: "Progress",
variants: [
{
id: "progress-default",
name: "Default",
component: ,
},
],
},
slider: {
name: "Slider",
variants: [
{
id: "slider-default",
name: "Default",
component: ,
},
],
},
textarea: {
name: "Textarea",
variants: [
{
id: "textarea-default",
name: "Default",
component: ,
},
],
},
dropdowns: {
name: "Dropdown Menu",
variants: [
{
id: "dropdown-default",
name: "Default",
component: (
Profile
Settings
Logout
),
},
],
},
"contact-form": {
name: "Contact Form",
variants: [
{
id: "contact-form-default",
name: "Default",
component: (
Contact Us
Fill out the form below to get in touch with us.
),
},
],
},
}
// Get all component IDs
export const componentIds = Object.keys(componentRegistry)
// Get a component by ID
export function getComponent(id: string) {
return componentRegistry[id]
}
// Get a variant by component ID and variant ID
export function getVariant(componentId: string, variantId: string) {
const component = componentRegistry[componentId]
if (!component) return null
return component.variants.find((variant) => variant.id === variantId) || null
}