File tree 2 files changed +15
-4
lines changed
packages/bento-design-system/src/IconButton
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,9 @@ import { BentoSprinkles } from "../internal";
3
3
4
4
export type IconButtonConfig = {
5
5
radius : BentoSprinkles [ "borderRadius" ] ;
6
- padding : Record < IconProps [ "size" ] , BentoSprinkles [ "padding" ] > ;
6
+ padding : Record <
7
+ IconProps [ "size" ] ,
8
+ | BentoSprinkles [ "padding" ]
9
+ | { paddingX : BentoSprinkles [ "paddingX" ] ; paddingY : BentoSprinkles [ "paddingY" ] }
10
+ > ;
7
11
} ;
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ export function IconButton(props: Props) {
37
37
} ,
38
38
ref
39
39
) ;
40
+
41
+ const paddingConfig = config . padding [ props . size ] ;
42
+
40
43
return (
41
44
< Box
42
45
as = "button"
@@ -56,9 +59,13 @@ export function IconButton(props: Props) {
56
59
alignItems = "center"
57
60
justifyContent = "center"
58
61
borderRadius = { config . radius }
59
- padding = { match ( props . kind )
60
- . with ( "solid" , "outline" , ( ) => config . padding [ props . size ] )
61
- . with ( "transparent" , ( ) => undefined )
62
+ { ...match ( props . kind )
63
+ . with ( "solid" , "outline" , ( ) =>
64
+ paddingConfig && typeof paddingConfig === "object" && "paddingX" in paddingConfig
65
+ ? paddingConfig
66
+ : { padding : paddingConfig }
67
+ )
68
+ . with ( "transparent" , ( ) => { } )
62
69
. exhaustive ( ) }
63
70
>
64
71
{ props . icon ( { size : props . size , color : "inherit" } ) }
You can’t perform that action at this time.
0 commit comments