Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: static/scss/_mixins.scss

Issue 29590583: Noissue - Applied responsive margin & padding mixins (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Patch Set: Created Oct. 27, 2017, 12:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « static/scss/_grid.scss ('k') | static/scss/_utilities.scss » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
+}
« no previous file with comments | « static/scss/_grid.scss ('k') | static/scss/_utilities.scss » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld