Skip to content

Commit 3a61095

Browse files
Nozzielkennylam
andauthored
fix(Button): adjust padding for icon-only buttons (#19991)
* fix(Button): adjust padding for icon-only buttons * fix(button): update icon-only button style for better alignment in react * fix(button): remove unnecessary empty lines --------- Co-authored-by: kennylam <909118+kennylam@users.noreply.github.com>
1 parent 2bd5afd commit 3a61095

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

packages/styles/scss/components/button/_button.scss

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,12 @@
150150
}
151151

152152
.#{$prefix}--btn--icon-only {
153+
align-items: center;
153154
justify-content: center;
154155
padding: 0;
155156
block-size: layout.size('height');
156157
inline-size: layout.size('height');
157-
// -1px to compensate for border width
158-
padding-block-start: min(
159-
calc(
160-
(layout.size('height') - convert.to-rem(16px)) / 2 - convert.to-rem(1px)
161-
),
162-
var(--temp-padding-block-max)
163-
);
158+
padding-block-start: 0;
164159

165160
> :first-child {
166161
min-inline-size: convert.to-rem(16px);

packages/web-components/src/components/button/button.scss

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,25 @@ $css--plex: true !default;
100100
}
101101
}
102102

103+
:host(#{$prefix}-button) {
104+
.#{$prefix}--btn--icon-only {
105+
align-items: center;
106+
padding-block-start: 0;
107+
108+
&.#{$prefix}--btn--selected,
109+
&.#{$prefix}--btn--expressive {
110+
padding: $spacing-03;
111+
}
112+
}
113+
}
114+
103115
:host(#{$prefix}-button[kind='ghost']) {
104116
.#{$prefix}--btn--ghost {
105117
&:hover,
106118
&:active {
107119
outline: none;
108120
}
109121

110-
&.#{$prefix}--btn--icon-only {
111-
padding-block-start: 0;
112-
113-
&.#{$prefix}--btn--selected,
114-
&.#{$prefix}--btn--expressive {
115-
padding: $spacing-03;
116-
}
117-
}
118-
119122
&:not(:focus) {
120123
box-shadow: none;
121124
}

0 commit comments

Comments
 (0)