|
1 |
| -import * as React from 'react'; |
2 |
| -import { Slot } from '@radix-ui/react-slot'; |
3 |
| -import { cva, type VariantProps } from 'class-variance-authority'; |
| 1 | +import * as React from "react" |
| 2 | +import { Slot } from "@radix-ui/react-slot" |
| 3 | +import { cva, type VariantProps } from "class-variance-authority" |
4 | 4 |
|
5 |
| -import { cn } from '@/lib/utils'; |
| 5 | +import { cn } from "@/lib/utils" |
6 | 6 |
|
7 | 7 | const buttonVariants = cva(
|
8 |
| - 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300', |
| 8 | + "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300", |
9 | 9 | {
|
10 | 10 | variants: {
|
11 | 11 | variant: {
|
12 |
| - default: |
13 |
| - 'bg-gray-900 text-gray-50 hover:bg-gray-900/90 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/90', |
| 12 | + default: "bg-gray-900 text-gray-50 hover:bg-gray-900/90 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/90", |
14 | 13 | destructive:
|
15 |
| - 'bg-red-500 text-gray-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90', |
| 14 | + "bg-red-500 text-gray-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90", |
16 | 15 | outline:
|
17 |
| - 'border border-gray-200 bg-white hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50', |
| 16 | + "border border-gray-200 bg-white hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50", |
18 | 17 | secondary:
|
19 |
| - 'bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80', |
20 |
| - ghost: |
21 |
| - 'hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-50', |
22 |
| - link: 'text-gray-900 underline-offset-4 hover:underline dark:text-gray-50', |
| 18 | + "bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80", |
| 19 | + ghost: "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-50", |
| 20 | + link: "text-gray-900 underline-offset-4 hover:underline dark:text-gray-50", |
23 | 21 | },
|
24 | 22 | size: {
|
25 |
| - default: 'h-10 px-4 py-2', |
26 |
| - sm: 'h-9 rounded-md px-3', |
27 |
| - lg: 'h-11 rounded-md px-8', |
28 |
| - icon: 'h-10 w-10', |
| 23 | + default: "h-10 px-4 py-2", |
| 24 | + sm: "h-9 rounded-md px-3", |
| 25 | + lg: "h-11 rounded-md px-8", |
| 26 | + icon: "h-10 w-10", |
29 | 27 | },
|
30 | 28 | },
|
31 | 29 | defaultVariants: {
|
32 |
| - variant: 'default', |
33 |
| - size: 'default', |
| 30 | + variant: "default", |
| 31 | + size: "default", |
34 | 32 | },
|
35 | 33 | }
|
36 |
| -); |
| 34 | +) |
37 | 35 |
|
38 | 36 | export interface ButtonProps
|
39 | 37 | extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
40 | 38 | VariantProps<typeof buttonVariants> {
|
41 |
| - asChild?: boolean; |
| 39 | + asChild?: boolean |
42 | 40 | }
|
43 | 41 |
|
44 | 42 | const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
45 | 43 | ({ className, variant, size, asChild = false, ...props }, ref) => {
|
46 |
| - const Comp = asChild ? Slot : 'button'; |
| 44 | + const Comp = asChild ? Slot : "button" |
47 | 45 | return (
|
48 | 46 | <Comp
|
49 | 47 | className={cn(buttonVariants({ variant, size, className }))}
|
50 | 48 | ref={ref}
|
51 | 49 | {...props}
|
52 | 50 | />
|
53 |
| - ); |
| 51 | + ) |
54 | 52 | }
|
55 |
| -); |
56 |
| -Button.displayName = 'Button'; |
| 53 | +) |
| 54 | +Button.displayName = "Button" |
57 | 55 |
|
58 |
| -export { Button, buttonVariants }; |
| 56 | +export { Button, buttonVariants } |
0 commit comments