-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
One issue with our styling is that it's pretty haphazard. It's never clear why certain values are chosen, and we often repeat values too. By using `calc()`, we can make the code more self-documenting and flexible. When you change a variable, it should correctly update all the other styling code automatically. -- This also recalibrates the icon sizes & removes the icon mixin, which didn't end up working well with the project. -- This PR should have no impact on the end user. It is only a refactor.
- Loading branch information
1 parent
4a5f616
commit 0b4da10
Showing
6 changed files
with
34 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,6 @@ | ||
$icon-size-xs: 20px; | ||
$icon-size-sm: 24px; | ||
$icon-size-md: 32px; | ||
$icon-size-sm: 20px; | ||
$icon-size-md: 24px; | ||
$icon-size-lg: 32px; | ||
|
||
// https://www.w3.org/WAI/WCAG21/Understanding/target-size.html | ||
$min-touch-target: 44px; | ||
|
||
@mixin touchable-icon($icon-size) { | ||
width: $icon-size; | ||
height: $icon-size; | ||
|
||
// Ensure minimum touch target size | ||
$touch-size: max($icon-size, $min-touch-target); | ||
min-width: $touch-size; | ||
min-height: $touch-size; | ||
|
||
// Center the icon within the touch target | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
// Add padding if icon is smaller than min touch target | ||
@if $icon-size < $min-touch-target { | ||
$padding: ($min-touch-target - $icon-size) / 2; | ||
padding: $padding; | ||
} | ||
} | ||
|
||
@mixin touchable-icon-xs { | ||
@include touchable-icon($icon-size-xs); | ||
} | ||
|
||
@mixin touchable-icon-sm { | ||
@include touchable-icon($icon-size-sm); | ||
} | ||
|
||
@mixin touchable-icon-md { | ||
@include touchable-icon($icon-size-md); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters