Spaces:
Sleeping
Sleeping
| 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-[8px] text-sm font-medium transition disabled:pointer-events-none disabled:opacity-45 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#23d6a2]", | |
| { | |
| variants: { | |
| variant: { | |
| default: "bg-[#23d6a2] text-[#06100d] hover:bg-[#5be6bd]", | |
| secondary: "border border-white/10 bg-white/[0.06] text-white hover:bg-white/[0.1]", | |
| ghost: "text-white/78 hover:bg-white/[0.08] hover:text-white", | |
| danger: "bg-[#ff6b7a] text-[#160507] hover:bg-[#ff8995]", | |
| }, | |
| size: { | |
| default: "h-10 px-4 py-2", | |
| sm: "h-8 px-3 text-xs", | |
| icon: "h-9 w-9", | |
| lg: "h-12 px-5", | |
| }, | |
| }, | |
| defaultVariants: { | |
| variant: "default", | |
| size: "default", | |
| }, | |
| }, | |
| ); | |
| export interface ButtonProps | |
| extends React.ButtonHTMLAttributes<HTMLButtonElement>, | |
| VariantProps<typeof buttonVariants> { | |
| asChild?: boolean; | |
| } | |
| const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( | |
| ({ className, variant, size, asChild = false, ...props }, ref) => { | |
| const Comp = asChild ? Slot : "button"; | |
| return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />; | |
| }, | |
| ); | |
| Button.displayName = "Button"; | |
| export { Button, buttonVariants }; | |