diff --git a/src/components/ui/alert.tsx b/src/components/ui/alert.tsx index e1ad6f2..19c5d3e 100644 --- a/src/components/ui/alert.tsx +++ b/src/components/ui/alert.tsx @@ -1,29 +1,56 @@ import { ComponentProps } from "react" +import { cva, type VariantProps } from "class-variance-authority" +import { cn } from "@/lib/utils" -type AlertVariant = "default" | "destructive" +const alertVariants = cva( + "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", + { + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) -function Alert({ className, variant = "default", children, ...props }: ComponentProps<"div"> & { variant?: AlertVariant }) { +function Alert({ + className, + variant, + ...props +}: ComponentProps<"div"> & VariantProps) { return (
-
-
-
{children}
-
-
-
+ /> ) } -function AlertTitle({ className, ...props }: ComponentProps<"div">) { - return
+function AlertTitle({ className, ...props }: ComponentProps<"h5">) { + return ( +
+ ) } function AlertDescription({ className, ...props }: ComponentProps<"div">) { - return
+ return ( +
+ ) } export { Alert, AlertTitle, AlertDescription } diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 20e874b..744fbe4 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1 +1,57 @@ -import styles from '@styles/m3-scss/button.module.scss'; +import { ComponentProps, forwardRef } from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const buttonVariants = cva( + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/90", + destructive: + "bg-destructive text-destructive-foreground hover:bg-destructive/90", + outline: + "border border-input bg-background hover:bg-accent hover:text-accent-foreground", + secondary: + "bg-secondary text-secondary-foreground hover:bg-secondary/80", + ghost: "hover:bg-accent hover:text-accent-foreground", + link: "text-primary underline-offset-4 hover:underline", + tonal: "bg-accent text-accent-foreground hover:bg-accent/80", + }, + size: { + default: "h-10 px-4 py-2", + sm: "h-9 rounded-md px-3", + lg: "h-11 rounded-md px-8", + icon: "h-10 w-10", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +export interface ButtonProps + extends ComponentProps<"button">, + VariantProps { + asChild?: boolean +} + +const Button = forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button" + return ( + + ) + } +) +Button.displayName = "Button" + +export { Button, buttonVariants } diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index 3771366..b9087e2 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -1,27 +1,77 @@ -import { ComponentProps } from "react" +import { ComponentProps, forwardRef } from "react" +import { cn } from "@/lib/utils" -function Card({ className, ...props }: ComponentProps<"div">) { - return
-} +const Card = forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +Card.displayName = "Card" -function CardHeader(props: ComponentProps<"div">) { - return
-} +const CardHeader = forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +CardHeader.displayName = "CardHeader" -function CardTitle(props: ComponentProps<"div">) { - return

-} +const CardTitle = forwardRef>( + ({ className, ...props }, ref) => ( +

+ ) +) +CardTitle.displayName = "CardTitle" -function CardContent(props: ComponentProps<"div">) { - return
-} +const CardDescription = forwardRef>( + ({ className, ...props }, ref) => ( +

+ ) +) +CardDescription.displayName = "CardDescription" -function CardFooter(props: ComponentProps<"div">) { - return

-} +const CardContent = forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +CardContent.displayName = "CardContent" -function CardAction(props: ComponentProps<"button">) { - return - ) -} +const chipVariants = cva( + "inline-flex items-center justify-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) -export { Chip } +interface ChipProps + extends ComponentProps<"div">, + VariantProps {} + +const Chip = forwardRef( + ({ className, variant, ...props }, ref) => { + return ( +
+ ) + } +) +Chip.displayName = "Chip" + +export { Chip, chipVariants } diff --git a/src/components/ui/hover-card.tsx b/src/components/ui/hover-card.tsx index 1624947..adc6737 100644 --- a/src/components/ui/hover-card.tsx +++ b/src/components/ui/hover-card.tsx @@ -1 +1,41 @@ -import styles from '@styles/m3-scss/hover-card.module.scss'; +"use client" + +import { ComponentProps } from "react" +import * as HoverCardPrimitive from "@radix-ui/react-hover-card" +import { cn } from "@/lib/utils" + +function HoverCard({ + ...props +}: ComponentProps) { + return +} + +function HoverCardTrigger({ + ...props +}: ComponentProps) { + return ( + + ) +} + +function HoverCardContent({ + className, + align = "center", + sideOffset = 4, + ...props +}: ComponentProps) { + return ( + + ) +} + +export { HoverCard, HoverCardTrigger, HoverCardContent } diff --git a/src/components/ui/progress.tsx b/src/components/ui/progress.tsx index 336ce12..13ee7d5 100644 --- a/src/components/ui/progress.tsx +++ b/src/components/ui/progress.tsx @@ -1 +1,30 @@ -export {} +"use client" + +import { ComponentProps } from "react" +import * as ProgressPrimitive from "@radix-ui/react-progress" +import { cn } from "@/lib/utils" + +function Progress({ + className, + value, + ...props +}: ComponentProps) { + return ( + + + + ) +} + +export { Progress } diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx index e831ba7..3af0a1a 100644 --- a/src/components/ui/sheet.tsx +++ b/src/components/ui/sheet.tsx @@ -1 +1,163 @@ -import styles from '@styles/m3-scss/sheet.module.scss'; +"use client" + +import { ComponentProps } from "react" +import * as SheetPrimitive from "@radix-ui/react-dialog" +import { cva, type VariantProps } from "class-variance-authority" +import XIcon from "lucide-react/dist/esm/icons/x" +import { cn } from "@/lib/utils" + +function Sheet({ ...props }: ComponentProps) { + return +} + +function SheetTrigger({ + ...props +}: ComponentProps) { + return +} + +function SheetClose({ + ...props +}: ComponentProps) { + return +} + +function SheetPortal({ + ...props +}: ComponentProps) { + return +} + +function SheetOverlay({ + className, + ...props +}: ComponentProps) { + return ( + + ) +} + +const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out", + { + variants: { + side: { + top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", + bottom: + "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", + left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + right: + "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + } +) + +interface SheetContentProps + extends ComponentProps, + VariantProps {} + +function SheetContent({ + side = "right", + className, + children, + ...props +}: SheetContentProps) { + return ( + + + + {children} + + + Close + + + + ) +} + +function SheetHeader({ + className, + ...props +}: ComponentProps<"div">) { + return ( +
+ ) +} + +function SheetFooter({ + className, + ...props +}: ComponentProps<"div">) { + return ( +
+ ) +} + +function SheetTitle({ + className, + ...props +}: ComponentProps) { + return ( + + ) +} + +function SheetDescription({ + className, + ...props +}: ComponentProps) { + return ( + + ) +} + +export { + Sheet, + SheetPortal, + SheetOverlay, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +} diff --git a/src/components/ui/slider.tsx b/src/components/ui/slider.tsx index 5594ed6..5f68155 100644 --- a/src/components/ui/slider.tsx +++ b/src/components/ui/slider.tsx @@ -1,25 +1,27 @@ +"use client" + import { ComponentProps } from "react" +import * as SliderPrimitive from "@radix-ui/react-slider" +import { cn } from "@/lib/utils" -interface SliderProps extends ComponentProps<"input"> { - min?: number - max?: number - step?: number -} - -function Slider({ className, min = 0, max = 100, step = 1, ...props }: SliderProps) { +function Slider({ + className, + ...props +}: ComponentProps) { return ( -
- -
-
-
-
-
-
-
-
-
-
+ + + + + + ) } diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx index 065c485..cb8d685 100644 --- a/src/components/ui/tabs.tsx +++ b/src/components/ui/tabs.tsx @@ -2,41 +2,58 @@ import { ComponentProps } from "react" import * as TabsPrimitive from "@radix-ui/react-tabs" +import { cn } from "@/lib/utils" function Tabs(props: ComponentProps) { - return + return } -function TabsList(props: ComponentProps) { +function TabsList({ + className, + ...props +}: ComponentProps) { return ( - -
-
{props.children}
-
-
+ ) } -function TabsTrigger({ children, className, ...props }: ComponentProps) { +function TabsTrigger({ + className, + ...props +}: ComponentProps) { return ( - - {children} - - - - - - - + /> ) } -function TabsContent(props: ComponentProps) { - return +function TabsContent({ + className, + ...props +}: ComponentProps) { + return ( + + ) } export { Tabs, TabsList, TabsTrigger, TabsContent }