Skip to content

Instantly share code, notes, and snippets.

@duncanmalashock
Created October 23, 2017 21:08
Show Gist options
  • Save duncanmalashock/fe60e1e421932f4bccad06aa164ea9b8 to your computer and use it in GitHub Desktop.
Save duncanmalashock/fe60e1e421932f4bccad06aa164ea9b8 to your computer and use it in GitHub Desktop.
SCSS for "stack", "inset", and "inline" container components
$space-zero: 0px;
$space-xs: 2px;
$space-s: 4px;
$space-m: 7px;
$space-l: 14px;
$space-xl: 30px;
$space-xxl: 64px;
$space-xxxl: 128px;
$spaces: (
zero: $space-zero,
xs: $space-xs,
s: $space-s,
m: $space-m,
l: $space-l,
xl: $space-xl,
xxl: $space-xxl,
xxxl: $space-xxxl
);
.container {
&.container--flush-left {
text-align: left;
}
&.container--flush-right {
text-align: right;
}
&.container--center {
text-align: center;
}
}
@each $key, $value in $spaces {
.container.container--inset-#{$key} {
padding: $value;
overflow: hidden;
}
}
@each $key, $value in $spaces {
.container.container--inline-#{$key} {
margin: -$value / 2;
& > .container__item {
display: inline-block;
vertical-align: middle;
margin: $value / 2;
}
}
}
@each $key, $value in $spaces {
.container.container--inline-stack-#{$key} {
margin-bottom: -$value / 2;
& > .container__item {
margin-bottom: $value / 2;
}
}
}
@each $key, $value in $spaces {
.container.container--stack-#{$key} {
& > .container__item:not(:last-child) {
margin-bottom: $value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment