From: harry Date: Wed, 22 Feb 2017 15:44:25 +0000 (+0530) Subject: Added margin and padding mixin for reusability! X-Git-Tag: v6.4.0-rc1~23^2~20^2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27cd5cd1de94d24e4eb3308f147711b8f9b714a9;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Added margin and padding mixin for reusability! No generated css whatsoever, only sass magic --- diff --git a/scss/prototype/_spacing.scss b/scss/prototype/_spacing.scss index b8b7c62a8..c1e3bfa27 100644 --- a/scss/prototype/_spacing.scss +++ b/scss/prototype/_spacing.scss @@ -37,6 +37,56 @@ $prototype-spacers: () !default; /// @type Number $prototype-spacers-count: 5 !default; +/// Margin helper mixin +/// @param {Number} $top [null] - Margin Top +/// @param {Number} $right [null] - Margin Right +/// @param {Number} $bottom [null] - Margin Bottom +/// @param {Number} $left [null] - Margin Left +@mixin margin( + $top: null, + $right: null, + $bottom: null, + $left: null +) { + @if $top != null { + margin-top: $top !important; + } + @if $right != null { + margin-right: $right !important; + } + @if $bottom != null { + margin-bottom: $bottom !important; + } + @if $left != null { + margin-left: $left !important; + } +} + +/// Padding helper mixin +/// @param {Number} $top [null] - Padding Top +/// @param {Number} $right [null] - Padding Right +/// @param {Number} $bottom [null] - Padding Bottom +/// @param {Number} $left [null] - Padding Left +@mixin padding( + $top: null, + $right: null, + $bottom: null, + $left: null +) { + @if $top != null { + padding-top: $top !important; + } + @if $right != null { + padding-right: $right !important; + } + @if $bottom != null { + padding-bottom: $bottom !important; + } + @if $left != null { + padding-left: $left !important; + } +} + // Looping through prototype spacers @for $i from 0 through $prototype-spacers-count { $prototype-spacers: map-merge($prototype-spacers, (