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

Side by Side Diff: static/scss/_mixins.scss

Issue 29590583: Noissue - Applied responsive margin & padding mixins (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Patch Set: Changed grid breakpoint and removed package-lock.json Created Oct. 27, 2017, 12:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « static/scss/_grid.scss ('k') | static/scss/_utilities.scss » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // This file is part of website-defaults
2 // Copyright (C) 2016-present eyeo GmbH
3 //
4 // website-defaults is free software: you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // website-defaults is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with website-defaults. If not, see <http://www.gnu.org/licenses/>.
16
17 @mixin padding-x($padding, $multiplier: 1)
juliandoucette 2017/10/27 13:40:01 Note: The multiplier was created for the negative
18 {
19 padding-left: $padding * $multiplier;
20 padding-right: $padding * $multiplier;
21 }
22
23 @mixin padding-y($padding, $multiplier: 1)
24 {
25 padding-top: $padding * $multiplier;
26 padding-bottom: $padding * $multiplier;
27 }
28
29 @mixin padding($padding, $axis: 'both', $multiplier: 1)
juliandoucette 2017/10/27 13:40:01 Note: These (padding|margin)[-x]* mixins could mak
30 {
31 @if ($axis == 'both' or $axis == 'y')
32 {
33 @include padding-y($padding, $multiplier);
34 }
35
36 @if ($axis == 'both' or $axis == 'x')
37 {
38 @include padding-x($padding, $multiplier);
39 }
40 }
41
42 @mixin padding-breakpoint($breakpoint, $padding, $axis: 'both', $multiplier: 1)
43 {
44 @if ($breakpoint == 'auto')
45 {
46 @include padding($padding, $axis, $multiplier);
47 }
48
49 @else
50 {
51 @media(min-width: $breakpoint)
52 {
53 @include padding($padding, $axis, $multiplier);
54 }
55 }
56 }
57
58 @mixin padding-breakpoints($breakpoints, $axis: 'both', $multiplier: 1)
juliandoucette 2017/10/27 13:40:01 Note: We should probably reverse this e.g. breakpo
59 {
60 @each $breakpoint, $padding in $breakpoints
61 {
62 @include padding-breakpoint($breakpoint, $padding, $axis, $multiplier);
63 }
64 }
65
66 @mixin margin-x($margin, $multiplier: 1)
67 {
68 margin-left: $margin * $multiplier;
69 margin-right: $margin * $multiplier;
70 }
71
72 @mixin margin-y($margin, $multiplier: 1)
73 {
74 margin-top: $margin * $multiplier;
75 margin-bottom: $margin * $multiplier;
76 }
77
78 @mixin margin($margin, $axis: 'both', $multiplier: 1)
79 {
80 @if ($axis == 'both' or $axis == 'y')
81 {
82 @include margin-y($margin, $multiplier);
83 }
84
85 @if ($axis == 'both' or $axis == 'x')
86 {
87 @include margin-x($margin, $multiplier);
88 }
89 }
90
91 @mixin margin-breakpoint($breakpoint, $margin, $axis: 'both', $multiplier: 1)
92 {
93 @if ($breakpoint == 'auto')
94 {
95 @include margin($margin, $axis, $multiplier);
96 }
97
98 @else
99 {
100 @media(min-width: $breakpoint)
101 {
102 @include margin($margin, $axis, $multiplier);
103 }
104 }
105 }
106
107 @mixin margin-breakpoints($breakpoints, $axis: 'both', $multiplier: 1)
108 {
109 @each $breakpoint, $margin in $breakpoints
110 {
111 @include margin-breakpoint($breakpoint, $margin, $axis, $multiplier);
112 }
113 }
OLDNEW
« 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