forked from Dshield-xyz/Dshield
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.tsx
More file actions
52 lines (49 loc) · 1.73 KB
/
Copy pathButton.tsx
File metadata and controls
52 lines (49 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { cva, type VariantProps } from "class-variance-authority";
import { forwardRef } from "react";
import { cn } from "@/lib/cn";
export const buttonVariants = cva(
"focus-ring inline-flex items-center justify-center gap-2 rounded-xl font-semibold transition-all duration-200 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100",
{
variants: {
variant: {
// High-emphasis call to action.
primary:
"bg-gradient-to-b from-brand-500 to-brand-600 text-white shadow-lg shadow-brand-950/50 hover:from-brand-400 hover:to-brand-500 hover:shadow-xl hover:shadow-brand-950/60",
// Brand-accented action (e.g. threshold disclosure).
accent:
"bg-brand-600 text-white shadow-lg shadow-brand-950/50 hover:bg-brand-500",
// Bordered, lower emphasis.
outline:
"border border-zinc-700 text-zinc-300 hover:border-zinc-500 hover:text-white",
// Quiet, text-only.
ghost: "text-zinc-400 hover:bg-zinc-800/60 hover:text-white",
},
size: {
sm: "px-3 py-1.5 text-xs",
md: "px-4 py-2 text-sm",
lg: "px-8 py-3 text-sm",
},
fullWidth: {
true: "w-full",
},
},
defaultVariants: {
variant: "primary",
size: "md",
},
},
);
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {}
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
function Button({ className, variant, size, fullWidth, ...props }, ref) {
return (
<button
ref={ref}
className={cn(buttonVariants({ variant, size, fullWidth }), className)}
{...props}
/>
);
},
);