Line data Source code
1 : import type { VariantProps } from 'cva'
2 : import { cva } from 'cva'
3 :
4 2356 : export const buttonVariants = cva({
5 : base: 'relative inline-flex cursor-pointer touch-manipulation appearance-none items-center justify-center gap-2 rounded-md border-none font-inter text-sm font-medium whitespace-nowrap transition-colors focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([width]):not([height])]:size-4',
6 : variants: {
7 : variant: {
8 : secondary: 'bg-secondary text-foreground hover:bg-accent',
9 : primary: 'bg-primary text-foreground hover:bg-primary/90',
10 : inverted: 'bg-foreground text-background hover:bg-foreground/80',
11 : destructive: 'bg-destructive text-foreground hover:bg-destructive/90',
12 : textonly: 'bg-transparent text-foreground hover:bg-accent',
13 : 'muted-textonly': 'bg-transparent text-muted-foreground hover:bg-accent',
14 : 'destructive-textonly':
15 : 'bg-transparent text-destructive hover:bg-destructive/10',
16 : outline:
17 : 'border border-solid bg-transparent text-foreground hover:bg-accent',
18 : link: 'bg-transparent text-muted-foreground hover:text-foreground',
19 : 'overlay-white': 'bg-white text-gray-600 hover:bg-white/90',
20 : base: 'bg-background text-foreground hover:bg-accent',
21 : tertiary: 'bg-muted text-foreground hover:bg-muted/80',
22 : subscribe:
23 : 'border-transparent bg-credit text-charcoal-800 hover:opacity-80',
24 : 'brand-ghost':
25 : 'bg-white/8 text-primary-warm-white hover:bg-white/20 focus-visible:ring-2 focus-visible:ring-brand-yellow',
26 : 'brand-solid':
27 : 'bg-brand-yellow text-primary-comfy-ink hover:bg-brand-yellow/90 focus-visible:ring-2 focus-visible:ring-primary-warm-white',
28 : 'brand-ghost-accent':
29 : 'bg-white/8 text-primary-warm-white hover:bg-brand-yellow hover:text-primary-comfy-ink focus-visible:ring-2 focus-visible:ring-brand-yellow'
30 : },
31 : size: {
32 : sm: 'h-6 rounded-sm px-2 py-1 text-xs',
33 : md: 'h-8 rounded-lg p-2 text-xs',
34 : lg: 'h-10 rounded-lg px-4 py-2 text-sm',
35 : 'icon-sm': 'size-5 p-0',
36 : icon: 'size-8 rounded-lg',
37 : 'icon-lg': 'size-10 rounded-lg',
38 : link: 'gap-1 px-0 py-2 text-sm/5 font-normal hover:underline',
39 : brand:
40 : 'h-12 rounded-2xl px-5 font-formula text-sm font-semibold tracking-[0.7px] uppercase lg:h-13 xl:h-14 2xl:h-16',
41 : 'brand-icon': 'size-10 rounded-2xl xl:size-12',
42 : unset: ''
43 : }
44 : },
45 :
46 : defaultVariants: {
47 : variant: 'secondary',
48 : size: 'md'
49 : }
50 : })
51 :
52 : export type ButtonVariants = VariantProps<typeof buttonVariants>
53 :
54 : const variants = [
55 : 'secondary',
56 : 'primary',
57 : 'inverted',
58 : 'destructive',
59 : 'textonly',
60 : 'muted-textonly',
61 : 'destructive-textonly',
62 : 'outline',
63 : 'link',
64 : 'base',
65 : 'tertiary',
66 : 'overlay-white',
67 : 'subscribe',
68 : 'brand-ghost',
69 : 'brand-solid',
70 : 'brand-ghost-accent'
71 : ] as const satisfies Array<ButtonVariants['variant']>
72 : const sizes = [
73 : 'sm',
74 : 'md',
75 : 'lg',
76 : 'icon-sm',
77 : 'icon',
78 : 'icon-lg',
79 : 'link',
80 : 'brand',
81 : 'brand-icon'
82 : ] as const satisfies Array<ButtonVariants['size']>
83 :
84 : export const FOR_STORIES = { variants, sizes } as const
|