|
| 1 | +import { tv } from 'tailwind-variants'; |
| 2 | + |
| 3 | +export const dialogVariants = tv({ |
| 4 | + defaultVariants: { |
| 5 | + size: 'md' |
| 6 | + }, |
| 7 | + slots: { |
| 8 | + close: `absolute`, |
| 9 | + content: [ |
| 10 | + `fixed left-[50%] top-[50%] z-50 flex flex-col w-full border bg-background shadow-lg translate-x-[-50%] translate-y-[-50%] md:w-full duration-200 sm:rounded-lg`, |
| 11 | + `data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`, |
| 12 | + `data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]` |
| 13 | + ], |
| 14 | + description: `text-muted-foreground`, |
| 15 | + footer: `flex flex-col-reverse sm:flex-row sm:justify-end`, |
| 16 | + header: `flex flex-col text-center sm:text-left`, |
| 17 | + overlay: [ |
| 18 | + `fixed inset-0 z-50 bg-black/80`, |
| 19 | + `data-[state=open]:animate-in data-[state=open]:fade-in-0`, |
| 20 | + `data-[state=closed]:animate-out data-[state=closed]:fade-out-0` |
| 21 | + ], |
| 22 | + title: `flex items-center font-semibold leading-none tracking-tight` |
| 23 | + }, |
| 24 | + variants: { |
| 25 | + size: { |
| 26 | + '2xl': { |
| 27 | + close: 'right-6 top-6', |
| 28 | + content: `gap-y-6 max-w-3xl px-7 py-6 text-xl`, |
| 29 | + description: 'text-xl', |
| 30 | + footer: 'gap-6', |
| 31 | + header: 'gap-y-6', |
| 32 | + title: 'gap-x-3.5 text-2xl' |
| 33 | + }, |
| 34 | + lg: { |
| 35 | + close: 'right-4 top-4', |
| 36 | + content: `gap-y-4 max-w-xl px-5 py-4 text-base`, |
| 37 | + description: 'text-base', |
| 38 | + footer: 'gap-4', |
| 39 | + header: 'gap-y-4', |
| 40 | + title: 'gap-x-2.5 text-lg' |
| 41 | + }, |
| 42 | + md: { |
| 43 | + close: 'right-3 top-3', |
| 44 | + content: `gap-y-3 max-w-lg px-4 py-3 text-sm`, |
| 45 | + description: 'text-sm', |
| 46 | + footer: 'gap-3', |
| 47 | + header: 'gap-y-3', |
| 48 | + title: 'gap-x-2 text-base' |
| 49 | + }, |
| 50 | + sm: { |
| 51 | + close: 'right-2 top-2', |
| 52 | + content: `gap-y-2 max-w-md px-3 py-2 text-xs`, |
| 53 | + description: 'text-xs', |
| 54 | + footer: 'gap-2', |
| 55 | + header: 'gap-y-2', |
| 56 | + title: 'gap-x-1.75 text-sm' |
| 57 | + }, |
| 58 | + xl: { |
| 59 | + close: 'right-5 top-5', |
| 60 | + content: `gap-y-5 max-w-2xl px-6 py-5 text-lg`, |
| 61 | + description: 'text-lg', |
| 62 | + footer: 'gap-5', |
| 63 | + header: 'gap-y-5', |
| 64 | + title: 'gap-x-3 text-xl' |
| 65 | + }, |
| 66 | + xs: { |
| 67 | + close: 'right-1.5 top-1.5', |
| 68 | + content: `gap-y-1.5 max-w-md px-2 py-1.5 text-2xs`, |
| 69 | + description: 'text-2xs', |
| 70 | + footer: 'gap-1.5', |
| 71 | + header: 'gap-y-1.5', |
| 72 | + title: 'gap-x-1.5 text-xs' |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | +}); |
| 77 | + |
| 78 | +export type DialogSlots = keyof typeof dialogVariants.slots; |
0 commit comments