Last active
October 25, 2019 22:32
-
-
Save brittonwalker/d180f29462f52f5f3e5196bd6b27a1ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// | |
// Resposive spacer classes | |
// -------------------------------------------------- | |
// Margin properties to cycle through | |
$margin-properties: ( | |
mt: margin-top, | |
mb: margin-bottom, | |
my: margin, | |
ml: margin-left, | |
mr: margin-right | |
); | |
$padding-properties: ( | |
pt: padding-top, | |
pb: padding-bottom, | |
py: padding, | |
pl: padding-left, | |
pr: padding-right | |
); | |
// Base number to multiply cycle length iterator | |
$base: 5; | |
// Cycle Length | |
$times: 60; | |
@each $name, | |
$number in $grid-breakpoints { | |
@media (min-width: $number) { | |
@each $prop-name, | |
$prop-val in $margin-properties { | |
@for $i from 0 through $times { | |
$value: $i * $base + 0px; | |
.#{$prop-name}-#{$name}-#{$i} { | |
@if $prop-name==my { | |
#{$prop-val}: $value 0px; | |
} | |
@else { | |
#{$prop-val}: $value; | |
} | |
} | |
} | |
} | |
@each $prop-name, | |
$prop-val in $padding-properties { | |
@for $i from 0 through $times { | |
$value: $i * $base + 0px; | |
.#{$prop-name}-#{$name}-#{$i} { | |
@if $prop-name==py { | |
#{$prop-val}: $value 0px; | |
} | |
@else { | |
#{$prop-val}: $value; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment