@@ -40,59 +40,62 @@ export interface BitButtonProps
4040 ref ?: React . Ref < HTMLButtonElement > ;
4141}
4242
43- function Button ( { children, ...props } : BitButtonProps ) {
43+ function Button ( { children, asChild , ...props } : BitButtonProps ) {
4444 const { variant, size, className, font } = props ;
4545
4646 return (
4747 < ShadcnButton
4848 { ...props }
4949 className = { cn (
50- "rounded-none active:translate-y-1 transition-transform relative" ,
50+ "rounded-none active:translate-y-1 transition-transform relative inline-flex items-center justify-center " ,
5151 font !== "normal" && "retro" ,
5252 className
5353 ) }
5454 size = { size }
5555 variant = { variant }
56+ asChild = { asChild }
5657 >
57- { children }
58+ < div >
59+ { children }
5860
59- { variant !== "ghost" && variant !== "link" && size !== "icon" && (
60- < >
61- { /* Pixelated border */ }
62- < div className = "absolute -top-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />
63- < div className = "absolute -top-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />
64- < div className = "absolute -bottom-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />
65- < div className = "absolute -bottom-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />
66- < div className = "absolute top-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
67- < div className = "absolute top-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
68- < div className = "absolute bottom-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
69- < div className = "absolute bottom-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
70- < div className = "absolute top-1.5 -left-1.5 h-2/3 w-1.5 bg-foreground dark:bg-ring" />
71- < div className = "absolute top-1.5 -right-1.5 h-2/3 w-1.5 bg-foreground dark:bg-ring" />
72- { variant !== "outline" && (
73- < >
74- { /* Top shadow */ }
75- < div className = "absolute top-0 left-0 w-full h-1.5 bg-foreground/20" />
76- < div className = "absolute top-1.5 left-0 w-3 h-1.5 bg-foreground/20" />
61+ { variant !== "ghost" && variant !== "link" && size !== "icon" && (
62+ < >
63+ { /* Pixelated border */ }
64+ < div className = "absolute -top-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />
65+ < div className = "absolute -top-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />
66+ < div className = "absolute -bottom-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />
67+ < div className = "absolute -bottom-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />
68+ < div className = "absolute top-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
69+ < div className = "absolute top-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
70+ < div className = "absolute bottom-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
71+ < div className = "absolute bottom-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
72+ < div className = "absolute top-1.5 -left-1.5 h-2/3 w-1.5 bg-foreground dark:bg-ring" />
73+ < div className = "absolute top-1.5 -right-1.5 h-2/3 w-1.5 bg-foreground dark:bg-ring" />
74+ { variant !== "outline" && (
75+ < >
76+ { /* Top shadow */ }
77+ < div className = "absolute top-0 left-0 w-full h-1.5 bg-foreground/20" />
78+ < div className = "absolute top-1.5 left-0 w-3 h-1.5 bg-foreground/20" />
7779
78- { /* Bottom shadow */ }
79- < div className = "absolute bottom-0 left-0 w-full h-1.5 bg-foreground/20" />
80- < div className = "absolute bottom-1.5 right-0 w-3 h-1.5 bg-foreground/20" />
81- </ >
82- ) }
83- </ >
84- ) }
80+ { /* Bottom shadow */ }
81+ < div className = "absolute bottom-0 left-0 w-full h-1.5 bg-foreground/20" />
82+ < div className = "absolute bottom-1.5 right-0 w-3 h-1.5 bg-foreground/20" />
83+ </ >
84+ ) }
85+ </ >
86+ ) }
8587
86- { size === "icon" && (
87- < >
88- < div className = "absolute top-0 left-0 w-full h-[5px] md:h-1.5 bg-foreground dark:bg-ring pointer-events-none" />
89- < div className = "absolute bottom-0 w-full h-[5px] md:h-1.5 bg-foreground dark:bg-ring pointer-events-none" />
90- < div className = "absolute top-1 -left-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
91- < div className = "absolute bottom-1 -left-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
92- < div className = "absolute top-1 -right-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
93- < div className = "absolute bottom-1 -right-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
94- </ >
95- ) }
88+ { size === "icon" && (
89+ < >
90+ < div className = "absolute top-0 left-0 w-full h-[5px] md:h-1.5 bg-foreground dark:bg-ring pointer-events-none" />
91+ < div className = "absolute bottom-0 w-full h-[5px] md:h-1.5 bg-foreground dark:bg-ring pointer-events-none" />
92+ < div className = "absolute top-1 -left-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
93+ < div className = "absolute bottom-1 -left-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
94+ < div className = "absolute top-1 -right-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
95+ < div className = "absolute bottom-1 -right-1 w-[5px] md:w-1.5 h-1/2 bg-foreground dark:bg-ring pointer-events-none" />
96+ </ >
97+ ) }
98+ </ div >
9699 </ ShadcnButton >
97100 ) ;
98101}
0 commit comments