Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

Commit

Permalink
Made margin and padding utilities consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Harrison committed Jun 4, 2017
1 parent 8d46aa2 commit 8dab612
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions 07 - utilities/_utilities.margins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,118 @@ Generates standard and responsive variants using spacing map located in settings
responsive breakpoints located in settings.breakpoints.
*/


// MARGIN
//--------------------------------------------------------------------------------------------------------------------------------------

// Example: u-margin-small
@each $sp-name, $sp-value in $spacing {
.u-margin-#{$sp-name} {
margin:rem($sp-value) !important;
}
}

// Changes margin when breakpoint is hit
// Example: u-margin-small@md
@each $bp-name, $bp-value in $breakpoints {
@include bp(#{$bp-name}) {
@each $sp-name, $sp-value in $spacing {
.u-margin-#{$sp-name}\@#{$bp-name} {
margin:rem($sp-value) !important;
}
}
}
}

// Changes margin until breakpoint is hit
// Example: u-margin-small@max-md
@each $bp-name, $bp-value in $breakpoints {
@include bpMax(#{$bp-name}) {
@each $sp-name, $sp-value in $spacing {
.u-margin-#{$sp-name}\@max-#{$bp-name} {
margin:rem($sp-value) !important;
}
}
}
}


// MARGIN HORIZONTAL
//--------------------------------------------------------------------------------------------------------------------------------------

// Example: u-margin-horizontal-small
@each $sp-name, $sp-value in $spacing {
.u-margin-horizontal-#{$sp-name} {
margin-left:rem($sp-value) !important;
margin-right:rem($sp-value) !important;
}
}

// Changes margin-horizontal when breakpoint is hit
// Example: u-margin-horizontal-small@md
@each $bp-name, $bp-value in $breakpoints {
@include bp(#{$bp-name}) {
@each $sp-name, $sp-value in $spacing {
.u-margin-horizontal-#{$sp-name}\@#{$bp-name} {
margin-left:rem($sp-value) !important;
margin-right:rem($sp-value) !important;
}
}
}
}

// Changes margin-horizontal until breakpoint is hit
// Example: u-margin-horizontal-small@max-md
@each $bp-name, $bp-value in $breakpoints {
@include bpMax(#{$bp-name}) {
@each $sp-name, $sp-value in $spacing {
.u-margin-horizontal-#{$sp-name}\@max-#{$bp-name} {
margin-left:rem($sp-value) !important;
margin-right:rem($sp-value) !important;
}
}
}
}


// MARGIN VERTICAL
//--------------------------------------------------------------------------------------------------------------------------------------

// Example: u-margin-vertical-small
@each $sp-name, $sp-value in $spacing {
.u-margin-vertical-#{$sp-name} {
margin-top:rem($sp-value) !important;
margin-bottom:rem($sp-value) !important;
}
}

// Changes margin-vertical when breakpoint is hit
// Example: u-margin-vertical-small@md
@each $bp-name, $bp-value in $breakpoints {
@include bp(#{$bp-name}) {
@each $sp-name, $sp-value in $spacing {
.u-margin-vertical-#{$sp-name}\@#{$bp-name} {
margin-top:rem($sp-value) !important;
margin-bottom:rem($sp-value) !important;
}
}
}
}

// Changes margin-vertical until breakpoint is hit
// Example: u-margin-vertical-small@max-md
@each $bp-name, $bp-value in $breakpoints {
@include bpMax(#{$bp-name}) {
@each $sp-name, $sp-value in $spacing {
.u-margin-vertical-#{$sp-name}\@max-#{$bp-name} {
margin-top:rem($sp-value) !important;
margin-bottom:rem($sp-value) !important;
}
}
}
}


// MARGIN TOP
//--------------------------------------------------------------------------------------------------------------------------------------

Expand Down

0 comments on commit 8dab612

Please sign in to comment.