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" /** * Buttons per §4 of the YouTube design system. * - 40px height, 20px radius (pill), 16px horizontal padding, Roboto 14px/500 * - Every variant defines hover, active/pressed and disabled states * - No shadows at rest; shadows are reserved for modals/dropdowns (§6) */ const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors duration-100 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-[#3ea6ff] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0f0f0f] aria-invalid:border-[#e1002d]", { variants: { variant: { // Primary CTA — #065FD4 → #3EA6FF hover → #0540AA pressed default: "bg-[#065fd4] text-white hover:bg-[#3ea6ff] active:bg-[#0540aa] disabled:bg-white/5 disabled:text-[#606060]", // Secondary — translucent white on dark surfaces secondary: "bg-white/[0.08] text-[#f1f1f1] hover:bg-white/[0.12] active:bg-white/[0.16] disabled:bg-white/[0.02] disabled:text-[#aaaaaa]", // Ghost / outlined — 1px hairline border, blue label outline: "border border-white/20 bg-transparent text-[#3ea6ff] hover:bg-[#065fd4]/[0.08] active:bg-[#065fd4]/[0.12] disabled:border-white/10 disabled:text-[#aaaaaa]", // Destructive — Error #E1002D → #FF0033 hover → #C30027 pressed destructive: "bg-[#e1002d] text-white hover:bg-[#ff0033] active:bg-[#c30027] disabled:bg-white/5 disabled:text-[#606060]", ghost: "bg-transparent text-[#eeeeee] hover:bg-white/[0.08] active:bg-white/[0.12] disabled:text-[#606060]", link: "bg-transparent text-[#3ea6ff] underline-offset-4 hover:underline hover:text-[#065fd4] active:text-[#0540aa] disabled:text-[#606060]", }, size: { // 40px pill is the system default default: "h-10 px-4 rounded-[20px] text-sm", sm: "h-8 px-3 rounded-[16px] text-[13.3px] gap-1.5", lg: "h-12 px-6 rounded-[24px] text-sm", // Icon button — circular, transparent, hover wash (§4 Icon Button) icon: "size-10 rounded-full p-0", "icon-sm": "size-8 rounded-full p-0", }, }, defaultVariants: { variant: "default", size: "default", }, } ) function Button({ className, variant, size, asChild = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean }) { const Comp = asChild ? Slot : "button" return ( ) } export { Button, buttonVariants }