Skip to content

Instantly share code, notes, and snippets.

@ifahrentholz
Created October 8, 2015 13:02
Show Gist options
  • Save ifahrentholz/a05433545949c8b2d6c5 to your computer and use it in GitHub Desktop.
Save ifahrentholz/a05433545949c8b2d6c5 to your computer and use it in GitHub Desktop.
$dspace: 24px;
$space--xs: round(0.25 * $dspace);
$space--s: round(0.5 * $dspace);
$space--m: round(2 * $dspace);
$space--l: round(4 * $dspace);
@mixin sizes($properties...) {
&--tiny {
@each $property in $properties {
#{$property}: $space--xs;
}
}
&--small {
@each $property in $properties {
#{$property}: $space--s;
}
}
&--medium {
@each $property in $properties {
#{$property}: $space--m;
}
}
&--large {
@each $property in $properties {
#{$property}: $space--l;
}
}
}
.btn {
display: block;
color: white;
background-color: green;
padding-top: $space--xs;
padding-bottom: $space--xs;
@include sizes(padding-right, padding-left)
}
.btn {
display: block;
color: white;
background-color: green;
padding-top: 6px;
padding-bottom: 6px;
}
.btn--tiny {
padding-right: 6px;
padding-left: 6px;
}
.btn--small {
padding-right: 12px;
padding-left: 12px;
}
.btn--medium {
padding-right: 48px;
padding-left: 48px;
}
.btn--large {
padding-right: 96px;
padding-left: 96px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment