Index: static/scss/_mixins.scss |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/static/scss/_mixins.scss |
@@ -0,0 +1,113 @@ |
+// This file is part of website-defaults |
+// Copyright (C) 2016-present eyeo GmbH |
+// |
+// website-defaults is free software: you can redistribute it and/or |
+// modify it under the terms of the GNU General Public License as published by |
+// the Free Software Foundation, either version 3 of the License, or |
+// (at your option) any later version. |
+// |
+// website-defaults is distributed in the hope that it will be useful, |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+// GNU General Public License for more details. |
+// |
+// You should have received a copy of the GNU General Public License |
+// along with website-defaults. If not, see <http://www.gnu.org/licenses/>. |
+ |
+@mixin padding-x($padding, $multiplier: 1) |
+{ |
+ padding-left: $padding * $multiplier; |
+ padding-right: $padding * $multiplier; |
+} |
+ |
+@mixin padding-y($padding, $multiplier: 1) |
+{ |
+ padding-top: $padding * $multiplier; |
+ padding-bottom: $padding * $multiplier; |
+} |
+ |
+@mixin padding($padding, $axis: 'both', $multiplier: 1) |
+{ |
+ @if ($axis == 'both' or $axis == 'y') |
+ { |
+ @include padding-y($padding, $multiplier); |
+ } |
+ |
+ @if ($axis == 'both' or $axis == 'x') |
+ { |
+ @include padding-x($padding, $multiplier); |
+ } |
+} |
+ |
+@mixin padding-breakpoint($breakpoint, $padding, $axis: 'both', $multiplier: 1) |
+{ |
+ @if ($breakpoint == 'auto') |
+ { |
+ @include padding($padding, $axis, $multiplier); |
+ } |
+ |
+ @else |
+ { |
+ @media(min-width: $breakpoint) |
+ { |
+ @include padding($padding, $axis, $multiplier); |
+ } |
+ } |
+} |
+ |
+@mixin padding-breakpoints($breakpoints, $axis: 'both', $multiplier: 1) |
+{ |
+ @each $breakpoint, $padding in $breakpoints |
+ { |
+ @include padding-breakpoint($breakpoint, $padding, $axis, $multiplier); |
+ } |
+} |
+ |
+@mixin margin-x($margin, $multiplier: 1) |
+{ |
+ margin-left: $margin * $multiplier; |
+ margin-right: $margin * $multiplier; |
+} |
+ |
+@mixin margin-y($margin, $multiplier: 1) |
+{ |
+ margin-top: $margin * $multiplier; |
+ margin-bottom: $margin * $multiplier; |
+} |
+ |
+@mixin margin($margin, $axis: 'both', $multiplier: 1) |
+{ |
+ @if ($axis == 'both' or $axis == 'y') |
+ { |
+ @include margin-y($margin, $multiplier); |
+ } |
+ |
+ @if ($axis == 'both' or $axis == 'x') |
+ { |
+ @include margin-x($margin, $multiplier); |
+ } |
+} |
+ |
+@mixin margin-breakpoint($breakpoint, $margin, $axis: 'both', $multiplier: 1) |
+{ |
+ @if ($breakpoint == 'auto') |
+ { |
+ @include margin($margin, $axis, $multiplier); |
+ } |
+ |
+ @else |
+ { |
+ @media(min-width: $breakpoint) |
+ { |
+ @include margin($margin, $axis, $multiplier); |
+ } |
+ } |
+} |
+ |
+@mixin margin-breakpoints($breakpoints, $axis: 'both', $multiplier: 1) |
+{ |
+ @each $breakpoint, $margin in $breakpoints |
+ { |
+ @include margin-breakpoint($breakpoint, $margin, $axis, $multiplier); |
+ } |
+} |