Spaces:
Sleeping
Sleeping
File size: 1,788 Bytes
d725335 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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 }
|