diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx new file mode 100644 index 0000000..a109756 --- /dev/null +++ b/src/components/ui/button.tsx @@ -0,0 +1,49 @@ +import * as React 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( + "focus-ring inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[background-color,border-color,color,box-shadow,filter,transform] duration-150 active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50", + { + variants: { + variant: { + default: + "bg-gradient-to-b from-primary via-primary to-primary/85 text-primary-foreground shadow-glow-sm hover:shadow-glow hover:brightness-110", + secondary: "bg-secondary/80 text-secondary-foreground hover:bg-secondary", + outline: + "border border-border/80 bg-card/55 backdrop-blur-sm hover:border-border hover:bg-muted/70", + ghost: "hover:bg-muted/70", + destructive: + "bg-gradient-to-b from-destructive via-destructive to-destructive/85 text-destructive-foreground shadow-[0_0_0_1px_hsl(var(--destructive)/0.3),0_2px_12px_-2px_hsl(var(--destructive)/0.45)] hover:brightness-110", + }, + size: { + sm: "h-8 px-3", + md: "h-9 px-3.5", + lg: "h-10 px-4", + icon: "h-9 w-9", + }, + }, + defaultVariants: { + variant: "default", + size: "md", + }, + }, +); + +export interface ButtonProps + extends React.ButtonHTMLAttributes, VariantProps { + asChild?: boolean; +} + +export const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button"; + return ( + + ); + }, +); +Button.displayName = "Button"; + +export { buttonVariants };