Skip to content

Commit 4d6edee

Browse files
authored
fix(button): use clamp for font sizes on circle shape (#29200)
1 parent 4b79bbe commit 4d6edee

File tree

56 files changed

+87
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+87
-7
lines changed

core/src/components/button/button.ios.scss

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,44 @@
149149
}
150150

151151
::slotted(ion-icon[slot="icon-only"]) {
152-
font-size: 1.125em;
152+
/**
153+
* The values were provided through a native iOS app.
154+
* min font size: 15px, default font size: 18px, max font size: 43px
155+
*
156+
* Since the `ion-button` uses `rem` for the font size, we can't
157+
* just pass the desired icon font size in `em` to the `
158+
* dynamic-font-clamp`. Instead, we need to adjust the base size
159+
* to account for the ion-button` font size.
160+
*
161+
* For example, if the default font size of `ion-button` is 16px
162+
* (derived from rem), then the base size can use the default font
163+
* size of the icon.
164+
*/
165+
font-size: dynamic-font-clamp(0.84, 18px, 2.39, 1em);
153166
}
154167

155168
:host(.button-small.button-has-icon-only) {
156169
// TODO(FW-6053): replace em value with the min-height variable.
157170
min-width: clamp(23px, 2.16em, 54px);
158171
// TODO(FW-6053): replace em value with the min-height variable.
159172
min-height: clamp(23px, 2.16em, 54px);
160-
161173
}
162174

163175
:host(.button-small) ::slotted(ion-icon[slot="icon-only"]) {
164-
font-size: 1.4em;
176+
/**
177+
* The values were provided through a native iOS app.
178+
* min font size: 12px, default font size: 17px, max font size: 40px
179+
*
180+
* Since the `ion-button` uses `rem` for the font size, we can't
181+
* just pass the desired icon font size in `em` to the `
182+
* dynamic-font-clamp`. Instead, we need to adjust the base size
183+
* to account for the ion-button` font size.
184+
*
185+
* For example, if the default font size of `ion-button` is 13px
186+
* (derived from rem) and the default font size of the icon is
187+
* 17px, then the base size would need to be increased.
188+
*/
189+
font-size: dynamic-font-clamp(0.58, 20.93px, 1.92, 1em);
165190
}
166191

167192
:host(.button-large.button-has-icon-only) {
@@ -172,7 +197,20 @@
172197
}
173198

174199
:host(.button-large) ::slotted(ion-icon[slot="icon-only"]) {
175-
font-size: 1em;
200+
/**
201+
* The values were provided through a native iOS app.
202+
* min font size: 15px, default font size: 18px, max font size: 43px
203+
*
204+
* Since the `ion-button` uses `rem` for the font size, we can't
205+
* just pass the desired icon font size in `em` to the `
206+
* dynamic-font-clamp`. Instead, we need to adjust the base size
207+
* to account for the ion-button` font size.
208+
*
209+
* For example, if the default font size of `ion-button` is 20px
210+
* (derived from rem) and the default font size of the icon is
211+
* 18px, then the base size would need to be decreased.
212+
*/
213+
font-size: dynamic-font-clamp(1.05, 14.4px, 2.99, 1em);
176214
}
177215

178216
// iOS Button Focused

core/src/components/button/button.md.scss

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,21 @@
142142
}
143143

144144
::slotted(ion-icon[slot="icon-only"]) {
145-
font-size: 1.6em;
145+
/**
146+
* The values were provided through MD design,
147+
* large and small are based on the iOS sizes.
148+
* min font size: 15px, default font size: 22.4px, max font size: 43px
149+
*
150+
* Since the `ion-button` uses `rem` for the font size, we can't
151+
* just pass the desired icon font size in `em` to the `
152+
* dynamic-font-clamp`. Instead, we need to adjust the base size
153+
* to account for the ion-button` font size.
154+
*
155+
* For example, if the default font size of `ion-button` is 14px
156+
* (derived from rem) and the default font size of the icon is
157+
* 22.4px, then the base size would need to be increased.
158+
*/
159+
font-size: dynamic-font-clamp(0.59, 25.6px, 1.68, 1em);
146160
}
147161

148162
:host(.button-small.button-has-icon-only) {
@@ -153,7 +167,21 @@
153167
}
154168

155169
:host(.button-small) ::slotted(ion-icon[slot="icon-only"]) {
156-
font-size: 1.23em;
170+
/**
171+
* The values were provided through MD design,
172+
* large and small are based on the iOS sizes.
173+
* min font size: 12px, default font size: 16px, max font size: 40px
174+
*
175+
* Since the `ion-button` uses `rem` for the font size, we can't
176+
* just pass the desired icon font size in `em` to the `
177+
* dynamic-font-clamp`. Instead, we need to adjust the base size
178+
* to account for the ion-button` font size.
179+
*
180+
* For example, if the default font size of `ion-button` is 13px
181+
* (derived from rem) and the default font size of the icon is
182+
* 16px, then the base size would need to be increased.
183+
*/
184+
font-size: dynamic-font-clamp(0.66, 19.7px, 2.05, 1em);
157185
}
158186

159187
:host(.button-large.button-has-icon-only) {
@@ -164,7 +192,21 @@
164192
}
165193

166194
:host(.button-large) ::slotted(ion-icon[slot="icon-only"]) {
167-
font-size: 1.4em;
195+
/**
196+
* The values were provided through MD design,
197+
* large and small are based on the iOS sizes.
198+
* min font size: 15px, default font size: 28px, max font size: 43px
199+
*
200+
* Since the `ion-button` uses `rem` for the font size, we can't
201+
* just pass the desired icon font size in `em` to the `
202+
* dynamic-font-clamp`. Instead, we need to adjust the base size
203+
* to account for the ion-button` font size.
204+
*
205+
* For example, if the default font size of `ion-button` is 20px
206+
* (derived from rem) and the default font size of the icon is
207+
* 28px, then the base size would need to be increased.
208+
*/
209+
font-size: dynamic-font-clamp(0.67, 22.4px, 1.92, 1em);
168210
}
169211

170212
// Material Design Button: Hover
-48 Bytes
-27 Bytes
-1 Bytes
-40 Bytes
-68 Bytes
-5 Bytes
51 Bytes
-1.81 KB

0 commit comments

Comments
 (0)