-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
282: Fix modular-spacing mixins and variables (#290)
* 282: modular-margin mixin * 282: modular margin and padding mixins with the vertical and horizontal variants; switch out values in _card.scss
- Loading branch information
1 parent
e2b1c4c
commit e104108
Showing
18 changed files
with
307 additions
and
239 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
23 changes: 23 additions & 0 deletions
23
core/scss/utilities/functions/modular-scale/_calculate-modular-spacing.scss
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@charset "UTF-8"; | ||
|
||
// | ||
// calculate-modular-spacing($step, $breakpoint) | ||
// | ||
// Calculates the modular spacing value at a step(integer) on the scale at a certain breakpoint. | ||
// | ||
// The modular spacing value is calculated by multiplying the modular spacing base value at the requested breakpoint and the multiplier at the requested step of the scale. | ||
// | ||
// The default value for $step is 0, which returns a multiplier value of 1, i.e., calculate-modular-spacing(0, 'xs') = $modular-spacing-base at XS breakpoint | ||
// | ||
// $step - Integers from -4 to 5 including 0 | ||
// $breakpoint - One of `xs`, `sm`, `md`, `lg`, `xl`, `2xl` | ||
// | ||
// Style guide: Functions.ModularScale.calculate-modular-spacing | ||
// | ||
@function calculate-modular-spacing($step: 0, $breakpoint: 'xl') { | ||
@if ($step >= -4 and $step <= 5) { | ||
@return get-modular-spacing-base($breakpoint) * get-modular-spacing-multiplier($step); | ||
} @else { | ||
@error '$step should be an integer between -4 and 5'; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
core/scss/utilities/functions/modular-scale/_get-modular-spacing-base.scss
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@charset "UTF-8"; | ||
|
||
// | ||
// get-modular-spacing-base($breakpoint) | ||
// | ||
// Get a value out of the modular-spacing-base map | ||
// Returns the pixel value of the $modular-spacing-base variable at a breakpoint. | ||
// | ||
// $breakpoint - One of `xs`, `sm`, `md`, `lg`, `xl`, `2xl` | ||
// | ||
// Style guide: Functions.ModularScale.get-modular-spacing-base | ||
// | ||
@function get-modular-spacing-base($breakpoint: 'xs') { | ||
$base: map-get($modular-spacing-base, $breakpoint); | ||
@if $base == null { | ||
@warn 'Non-existent key in get-modular-spacing-base: $breakpoint'; | ||
} | ||
@return $base; | ||
} |
18 changes: 18 additions & 0 deletions
18
core/scss/utilities/functions/modular-scale/_get-modular-spacing-multiplier.scss
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@charset "UTF-8"; | ||
|
||
// | ||
// get-modular-spacing-multiplier($step) | ||
// | ||
// Get a value out of the modular-spacing-multiplier map. | ||
// Returns the value of the $modular-spacing-multiplier variable at a step(integer) on the scale. | ||
// The default for $step is 0, which returns a multiplier value of 1. | ||
// | ||
// $step - Integers from -4 to 5 including 0 | ||
// | ||
// Style guide: Functions.ModularScale.get-modular-spacing-multiplier | ||
// | ||
@function get-modular-spacing-multiplier($step: 0) { | ||
@if ($step >= -4 and $step <= 5) { | ||
@return map_get($modular-spacing-multiplier, $step); | ||
} | ||
} |
Oops, something went wrong.