Javier
UI Functional, next fixing automations
d725335
Raw
History Blame Contribute Delete
1.79 kB
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(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40 [&_svg]:size-4 [&_svg]:shrink-0 active:scale-[0.98] select-none",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground font-semibold shadow-[0_0_0_1px_oklch(0.885_0.19_122_/_0.4),0_8px_24px_-12px_oklch(0.885_0.19_122_/_0.6)] hover:brightness-110",
secondary:
"bg-secondary text-secondary-foreground border border-border hover:bg-accent hover:border-white/15",
ghost: "text-muted-foreground hover:text-foreground hover:bg-white/5",
outline:
"border border-border bg-transparent hover:bg-white/5 hover:text-foreground",
destructive:
"bg-destructive/15 text-destructive border border-destructive/40 hover:bg-destructive/25",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-11 rounded-lg px-6 text-[0.95rem]",
icon: "size-9",
},
},
defaultVariants: { variant: "default", size: "default" },
},
)
function Button({
className,
variant,
size,
asChild = false,
...props
}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & { asChild?: boolean }) {
const Comp = asChild ? Slot : "button"
return (
<Comp className={cn(buttonVariants({ variant, size, className }))} {...props} />
)
}
export { Button, buttonVariants }