Last active
September 13, 2016 14:29
-
-
Save 8lane/9e8fb1971270498a073b22c4b48be1ee to your computer and use it in GitHub Desktop.
ANW Scaffolding with legacy spacing classes support
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
/* Scaffolding | |
/*--------------------------------------------------------------*/ | |
/* Legacy spacing from website (e.g. row--vertical-spacing-top-2) used heavily | |
throughout app should be deprecated and Bootstrap 4 spacing used instead */ | |
@for $i from 0 to 6 { | |
.row--vertical-spacing-#{$i} { margin-top: $grid-gutter-width * $i; margin-bottom: $grid-gutter-width * $i; } | |
.row--vertical-spacing-top-#{$i} { margin-top: $grid-gutter-width * $i; } | |
.row--vertical-spacing-bottom-#{$i} { margin-bottom: $grid-gutter-width * $i; } | |
} | |
/*--------------------------------------------------------------*/ | |
/* Modified Bootstrap 4 alpha spacing */ | |
/*--------------------------------------------------------------*/ | |
$spacer: $grid-gutter-width / 2 !default; | |
$spacer-x: $spacer !default; | |
$spacer-y: $spacer !default; | |
$spacers: ( | |
0: ( | |
x: 0, | |
y: 0 | |
), | |
1: ( | |
x: $spacer-x, | |
y: $spacer-y | |
), | |
2: ( | |
x: ($spacer-x * 2), | |
y: ($spacer-y * 2) | |
), | |
3: ( | |
x: ($spacer-x * 3), | |
y: ($spacer-y * 3) | |
) | |
) !default; | |
.w-100 { width: 100% !important; } | |
// Margin and Padding | |
.m-x-auto { | |
margin-right: auto !important; | |
margin-left: auto !important; | |
} | |
@each $prop, $abbrev in (margin: m, padding: p) { | |
@each $size, $lengths in $spacers { | |
$length-x: map-get($lengths, x); | |
$length-y: map-get($lengths, y); | |
.#{$abbrev}-a-#{$size} { #{$prop}: $length-y $length-x !important; } // a = All sides | |
.#{$abbrev}-t-#{$size} { #{$prop}-top: $length-y !important; } | |
.#{$abbrev}-r-#{$size} { #{$prop}-right: $length-x !important; } | |
.#{$abbrev}-b-#{$size} { #{$prop}-bottom: $length-y !important; } | |
.#{$abbrev}-l-#{$size} { #{$prop}-left: $length-x !important; } | |
// Axes | |
.#{$abbrev}-x-#{$size} { | |
#{$prop}-right: $length-x !important; | |
#{$prop}-left: $length-x !important; | |
} | |
.#{$abbrev}-y-#{$size} { | |
#{$prop}-top: $length-y !important; | |
#{$prop}-bottom: $length-y !important; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment