1"use client"
2
3import * as React from "react"
4import { Slot } from "@radix-ui/react-slot"
5import { cva } from "class-variance-authority"
6
7import { cn } from "@/lib/utils"
8
9const buttonVariantsOuter = cva("", {
10 variants: {
11 variant: {
12 primary:
13 "w-full border border-[1px] dark:border-[2px] border-black/10 dark:border-black bg-gradient-to-b from-black/70 to-black dark:from-white dark:to-white/80 p-[1px] transition duration-300 ease-in-out ",
14 accent:
15 "w-full border-[1px] dark:border-[2px] border-black/10 dark:border-neutral-950 bg-gradient-to-b from-indigo-300/90 to-indigo-500 dark:from-indigo-200/70 dark:to-indigo-500 p-[1px] transition duration-300 ease-in-out ",
16 destructive:
17 "w-full border-[1px] dark:border-[2px] border-black/10 dark:border-neutral-950 bg-gradient-to-b from-red-300/90 to-red-500 dark:from-red-300/90 dark:to-red-500 p-[1px] transition duration-300 ease-in-out ",
18 secondary:
19 "w-full border-[1px] dark:border-[2px] border-black/20 bg-white/50 dark:border-neutral-950 dark:bg-neutral-600/50 p-[1px] transition duration-300 ease-in-out ",
20 minimal:
21 "group/texture-button w-full border-[1px] dark:border-[2px] border-black/20 bg-white/50 dark:border-neutral-950 dark:bg-neutral-600/80 p-[1px] active:bg-neutral-200 dark:active:bg-neutral-800 hover:bg-gradient-to-t hover:from-neutral-100 to-white dark:hover:from-neutral-600/50 dark:hover:to-neutral-600/70",
22 icon: "group/texture-button rounded-full border dark:border-neutral-950 border-black/10 dark:bg-neutral-600/50 bg-white/50 p-[1px] active:bg-neutral-200 dark:active:bg-neutral-800 hover:bg-gradient-to-t hover:from-neutral-100 to-white dark:hover:from-neutral-700 dark:hover:to-neutral-600",
23 },
24 size: {
25 sm: "rounded-[6px]",
26 default: "rounded-[12px]",
27 lg: "rounded-[12px]",
28 icon: "rounded-full",
29 },
30 },
31 defaultVariants: {
32 variant: "primary",
33 size: "default",
34 },
35})
36
37const innerDivVariants = cva(
38 "w-full h-full flex items-center justify-center text-muted-foreground",
39 {
40 variants: {
41 variant: {
42 primary:
43 "gap-2 bg-gradient-to-b from-neutral-800 to-black dark:from-neutral-200 dark:to-neutral-50 text-sm text-white/90 dark:text-black/80 transition duration-300 ease-in-out hover:from-stone-800 hover:to-neutral-800/70 dark:hover:from-stone-200 dark:hover:to-neutral-200 dark:active:from-stone-300 dark:active:to-neutral-300 active:bg-gradient-to-b active:from-black active:to-black ",
44 accent:
45 "gap-2 bg-gradient-to-b from-indigo-400 to-indigo-600 text-sm text-white/90 transition duration-300 ease-in-out hover:bg-gradient-to-b hover:from-indigo-400/70 hover:to-indigo-600/70 dark:hover:from-indigo-400/70 dark:hover:to-indigo-600/70 active:bg-gradient-to-b active:from-indigo-400/80 active:to-indigo-600/80 dark:active:from-indigo-400 dark:active:to-indigo-600",
46 destructive:
47 "gap-2 bg-gradient-to-b from-red-400/60 to-red-500/60 text-sm text-white/90 transition duration-300 ease-in-out hover:bg-gradient-to-b hover:from-red-400/70 hover:to-red-600/70 dark:hover:from-red-400/70 dark:hover:to-red-500/80 active:bg-gradient-to-b active:from-red-400/80 active:to-red-600/80 dark:active:from-red-400 dark:active:to-red-500",
48 secondary:
49 "bg-gradient-to-b from-neutral-100/80 to-neutral-200/50 dark:from-neutral-800 dark:to-neutral-700/50 text-sm transition duration-300 ease-in-out hover:bg-gradient-to-b hover:from-neutral-200/40 hover:to-neutral-300/60 dark:hover:from-neutral-700 dark:hover:to-neutral-700/60 active:bg-gradient-to-b active:from-neutral-200/60 active:to-neutral-300/70 dark:active:from-neutral-800 dark:active:to-neutral-700",
50 minimal:
51 "bg-gradient-to-b from-white to-neutral-50/50 dark:from-neutral-800 dark:to-neutral-700/50 text-sm transition duration-300 ease-in-out group-hover/texture-button:bg-gradient-to-b group-hover/texture-button:from-neutral-50/50 group-hover/texture-button:to-neutral-100/60 dark:group-hover/texture-button:from-neutral-700 dark:group-hover/texture-button:to-neutral-700/60 group-active/texture-button:bg-gradient-to-b group-active/texture-button:from-neutral-100/60 group-active/texture-button:to-neutral-100/90 dark:group-active/texture-button:from-neutral-800 dark:group-active/texture-button:to-neutral-700",
52 icon: "bg-gradient-to-b from-white to-neutral-50/50 dark:from-neutral-800 dark:to-neutral-700/50 group-active/texture-button:bg-neutral-200 dark:group-active/texture-button:bg-neutral-800 rounded-full",
53 },
54 size: {
55 sm: "text-xs rounded-[4px] px-4 py-1",
56 default: "text-sm rounded-[10px] px-4 py-2",
57 lg: "text-base rounded-[10px] px-4 py-2",
58 icon: " rounded-full p-1",
59 },
60 },
61 defaultVariants: {
62 variant: "primary",
63 size: "default",
64 },
65 }
66)
67
68export interface UnifiedButtonProps
69 extends React.ButtonHTMLAttributes<HTMLButtonElement> {
70 variant?:
71 | "primary"
72 | "secondary"
73 | "accent"
74 | "destructive"
75 | "minimal"
76 | "icon"
77 size?: "default" | "sm" | "lg" | "icon"
78 asChild?: boolean
79}
80
81const TextureButton = React.forwardRef<HTMLButtonElement, UnifiedButtonProps>(
82 (
83 {
84 children,
85 variant = "primary",
86 size = "default",
87 asChild = false,
88 className,
89 ...props
90 },
91 ref
92 ) => {
93 const Comp = asChild ? Slot : "button"
94
95 return (
96 <Comp
97 className={cn(buttonVariantsOuter({ variant, size }), className)}
98 ref={ref}
99 {...props}
100 >
101 <div className={cn(innerDivVariants({ variant, size }))}>
102 {children}
103 </div>
104 </Comp>
105 )
106 }
107)
108
109TextureButton.displayName = "TextureButton"
110
111export { TextureButton }
112
113// export default TextureButton
114