Skip to content

Commit

Permalink
fix(button): use clamp for font sizes on circle shape (#29200)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetaPC authored Apr 3, 2024
1 parent 4b79bbe commit 4d6edee
Show file tree
Hide file tree
Showing 56 changed files with 87 additions and 7 deletions.
46 changes: 42 additions & 4 deletions core/src/components/button/button.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,44 @@
}

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

:host(.button-small.button-has-icon-only) {
// TODO(FW-6053): replace em value with the min-height variable.
min-width: clamp(23px, 2.16em, 54px);
// TODO(FW-6053): replace em value with the min-height variable.
min-height: clamp(23px, 2.16em, 54px);

}

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

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

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

// iOS Button Focused
Expand Down
48 changes: 45 additions & 3 deletions core/src/components/button/button.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,21 @@
}

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

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

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

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

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

// Material Design Button: Hover
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d6edee

Please sign in to comment.