@@ -7,6 +7,8 @@ import { type VariantProps, cva } from "class-variance-authority";
7
7
import { forwardRef } from "react" ;
8
8
import { cn } from "utils/cn" ;
9
9
10
+ // Be careful when changing the child styles from the button such as images
11
+ // because they can override the styles from other components like Avatar.
10
12
const buttonVariants = cva (
11
13
`
12
14
inline-flex items-center justify-center gap-1 whitespace-nowrap font-sans
@@ -15,8 +17,8 @@ const buttonVariants = cva(
15
17
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-content-link
16
18
disabled:pointer-events-none disabled:text-content-disabled
17
19
[&:is(a):not([href])]:pointer-events-none [&:is(a):not([href])]:text-content-disabled
18
- [&_svg ]:pointer-events-none [&_svg ]:shrink-0 [&_svg ]:p-0.5
19
- [&_img ]:pointer-events-none [&_img ]:shrink-0 [&_img ]:p-0.5
20
+ [&>svg ]:pointer-events-none [&>svg ]:shrink-0 [&>svg ]:p-0.5
21
+ [&>img ]:pointer-events-none [&>img ]:shrink-0 [&>img ]:p-0.5
20
22
` ,
21
23
{
22
24
variants : {
@@ -42,11 +44,11 @@ const buttonVariants = cva(
42
44
} ,
43
45
44
46
size : {
45
- lg : "min-w-20 h-10 px-3 py-2 [&_svg ]:size-icon-lg [&_img ]:size-icon-lg" ,
46
- sm : "min-w-20 h-8 px-2 py-1.5 text-xs [&_svg ]:size-icon-sm [&_img ]:size-icon-sm" ,
47
+ lg : "min-w-20 h-10 px-3 py-2 [&>svg ]:size-icon-lg [&>img ]:size-icon-lg" ,
48
+ sm : "min-w-20 h-8 px-2 py-1.5 text-xs [&>svg ]:size-icon-sm [&>img ]:size-icon-sm" ,
47
49
xs : "min-w-8 py-1 px-2 text-2xs rounded-md" ,
48
- icon : "size-8 px-1.5 [&_svg ]:size-icon-sm [&_img ]:size-icon-sm" ,
49
- "icon-lg" : "size-10 px-2 [&_svg ]:size-icon-lg [&_img ]:size-icon-lg" ,
50
+ icon : "size-8 px-1.5 [&>svg ]:size-icon-sm [&>img ]:size-icon-sm" ,
51
+ "icon-lg" : "size-10 px-2 [&>svg ]:size-icon-lg [&>img ]:size-icon-lg" ,
50
52
} ,
51
53
} ,
52
54
defaultVariants : {
0 commit comments