Skip to content

Commit

Permalink
feat(spacing settings, new padding utils): adds padding util classes
Browse files Browse the repository at this point in the history
affects: @buildit/gravity-ui-web

adds padding map to settings and generates padding utils
  • Loading branch information
Dan Bull committed Aug 15, 2019
1 parent 359b866 commit 9cb0e94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{%- include 'organisms-page-header' -%}
{%- block pageContent %}
<main class="grav-u-pb-xl">
<main>
{% block mainContent -%}
{#
Just some dummy example content.
Expand Down
12 changes: 12 additions & 0 deletions packages/gravity-ui-web/src/sass/00-settings/_spacing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ $grav-sp-l: grav-sp-calc(1);
$grav-sp-xl: grav-sp-calc(2);
$grav-sp-xxl: grav-sp-calc(3);


// Global map of one-dimensional space sizes, plus zero
$grav-sp-map: (
'none': 0,
'xs': $grav-sp-xs,
's': $grav-sp-s,
'm': $grav-sp-m,
'l': $grav-sp-l,
'xl': $grav-sp-xl,
'xxl': $grav-sp-xl
);

// Global set of two-dimensional insets (typically used as padding values)
$grav-sp-inset-xs: $grav-sp-xs $grav-sp-xs;
$grav-sp-inset-s: $grav-sp-s $grav-sp-s;
Expand Down
3 changes: 1 addition & 2 deletions packages/gravity-ui-web/src/sass/06-utilities/_padding.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
$grav-sides: (top, bottom, left, right);
$grav-spaces-map: ('xs': $grav-sp-s,'s': $grav-sp-s, 'm': $grav-sp-m, 'l': $grav-sp-l, 'xl': $grav-sp-xl, 'xxl': $grav-sp-xl);

// Generate utility classes for available spacing sizes
@each $name, $space in $grav-spaces-map {
@each $name, $space in $grav-sp-map {
@each $side in $grav-sides {
.grav-u-p#{str-slice($side, 0, 1)}-#{$name} {
padding-#{$side}: #{$space} !important;
Expand Down

0 comments on commit 9cb0e94

Please sign in to comment.