Created
July 11, 2017 14:39
-
-
Save chrislopresto/d6e65d851bf0affc592a2d086304fa60 to your computer and use it in GitHub Desktop.
Responsive utility classes
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
$sc-display-values: ( | |
'none': 'none', | |
'block': 'block', | |
'inline-block': 'inline-block', | |
'inline': 'inline', | |
'flex': 'flex', | |
) !default; | |
@mixin generate-display-classes { | |
@each $sc-breakpoint-name, $sc-breakpoint-value in sc-responsive-utility-breakpoints() { | |
@include mq($sc-breakpoint-name) { | |
@each $property-namespace, $property-value in $sc-display-values { | |
.u-display-#{$property-namespace}#{sc-breakpoint-token($sc-breakpoint-name)} { | |
display: unquote($property-value) !important; | |
} | |
} | |
} | |
} | |
} | |
@include generate-display-classes; |
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
/* ========================================================================== | |
#SPACINGS | |
========================================================================== */ | |
/** | |
* Utility classes to put specific spacing values onto elements. The below loop | |
* will generate us a suite of classes like: | |
* | |
* .u-margin-top {} | |
* .u-padding-left@medium {} | |
* .u-padding-horizontal {} | |
* .u-padding-vertical-none {} | |
*/ | |
$sc-spacing-directions: ( | |
null: null, | |
'-top': '-top', | |
'-right': '-right', | |
'-bottom': '-bottom', | |
'-left': '-left', | |
'-horizontal': '-left' '-right', | |
'-vertical': '-top' '-bottom', | |
) !default; | |
$sc-spacing-properties: ( | |
'padding': 'padding', | |
'margin': 'margin', | |
) !default; | |
$sc-spacing-sizes: ( | |
null: $sc-global-spacing-unit, | |
'-none': 0 | |
) !default; | |
@each $sc-breakpoint-name, $sc-breakpoint-value in sc-responsive-utility-breakpoints() { | |
@include mq($sc-breakpoint-name) { | |
@each $property-namespace, $property in $sc-spacing-properties { | |
@each $direction-namespace, $direction-rules in $sc-spacing-directions { | |
@each $size-namespace, $size in $sc-spacing-sizes { | |
.u-#{$property-namespace}#{$direction-namespace}#{$size-namespace}#{sc-breakpoint-token($sc-breakpoint-name)} { | |
@each $direction in $direction-rules { | |
#{$property}#{$direction}: $size !important; | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment