UNPKG

3.53 kBSCSSView Raw
1// Foundation for Sites by ZURB
2// foundation.zurb.com
3// Licensed under MIT Open Source
4
5////
6/// @group grid
7////
8
9/// Outputs CSS classes for the grid.
10/// @access private
11@mixin foundation-grid(
12 $row: 'row',
13 $column: 'column',
14 $column-row: 'column-row',
15 $gutter: 'gutter',
16 $push: 'push',
17 $pull: 'pull',
18 $center: 'centered',
19 $uncenter: 'uncentered',
20 $collapse: 'collapse',
21 $uncollapse: 'uncollapse',
22 $offset: 'offset',
23 $end: 'end',
24 $expanded: 'expanded',
25 $block: 'block'
26) {
27 // Row
28 .#{$row} {
29 @include grid-row;
30
31 // Collapsing
32 &.#{$collapse} {
33 > .#{$column} {
34 @include grid-col-collapse;
35 }
36 }
37
38 // Nesting
39 & .#{$row} {
40 @include grid-row-nest($grid-column-gutter);
41
42 &.#{$collapse} {
43 margin-right: 0;
44 margin-left: 0;
45 }
46 }
47
48 // Expanded (full-width) row
49 &.#{$expanded} {
50 @include grid-row-size(expand);
51
52 .#{$row} {
53 margin-right: auto;
54 margin-left: auto;
55 }
56 }
57
58 &:not(.#{$expanded}) .#{$row} {
59 @include grid-row-size(expand);
60 }
61
62 @if type-of($grid-column-gutter) == 'map' {
63 // Static (unresponsive) row gutters
64 //
65 @each $breakpoint, $value in $grid-column-gutter {
66 &.#{$gutter}-#{$breakpoint} {
67 > .#{$column} {
68 @include grid-col-gutter($value);
69 }
70 }
71 }
72 }
73 }
74
75 // Column
76 .#{$column} {
77 @include grid-col;
78
79 @if $grid-column-align-edge {
80 &.#{$end} {
81 @include grid-col-end;
82 }
83 }
84 }
85
86 // Column row
87 // The double .row class is needed to bump up the specificity
88 .#{$column}.#{$row}.#{$row} {
89 float: none;
90 }
91
92 // To properly nest a column row, padding and margin is removed
93 .#{$row} .#{$column}.#{$row}.#{$row} {
94 margin-right: 0;
95 margin-left: 0;
96 padding-right: 0;
97 padding-left: 0;
98 }
99
100 @include -zf-each-breakpoint {
101 @for $i from 1 through $grid-column-count {
102 // Column width
103 .#{$-zf-size}-#{$i} {
104 @include grid-col-size($i);
105 }
106
107 // Source ordering
108 @if $i < $grid-column-count {
109 .#{$-zf-size}-#{$push}-#{$i} {
110 @include grid-col-pos($i);
111 }
112
113 .#{$-zf-size}-#{$pull}-#{$i} {
114 @include grid-col-pos(-$i);
115 }
116 }
117
118 // Offsets
119 $o: $i - 1;
120
121 .#{$-zf-size}-#{$offset}-#{$o} {
122 @include grid-col-off($o);
123 }
124 }
125
126 // Block grid
127 @for $i from 1 through $block-grid-max {
128 .#{$-zf-size}-up-#{$i} {
129 @include grid-layout($i, '.#{$column}');
130 }
131 }
132
133 // Responsive collapsing
134 .#{$-zf-size}-#{$collapse} {
135 > .#{$column} { @include grid-col-collapse; }
136
137 .#{$row} {
138 margin-right: 0;
139 margin-left: 0;
140 }
141 }
142
143 .#{$expanded}.#{$row} .#{$-zf-size}-#{$collapse}.#{$row} {
144 margin-right: 0;
145 margin-left: 0;
146 }
147
148 .#{$-zf-size}-#{$uncollapse} {
149 > .#{$column} { @include grid-col-gutter($-zf-size); }
150 }
151
152 // Positioning
153 .#{$-zf-size}-#{$center} {
154 @include grid-col-pos(center);
155 }
156
157 // Gutter adjustment
158 .#{$-zf-size}-#{$uncenter},
159 .#{$-zf-size}-#{$push}-0,
160 .#{$-zf-size}-#{$pull}-0 {
161 @include grid-col-unpos;
162 }
163 }
164
165 // Block grid columns
166 .#{$column}-#{$block} {
167 @include grid-column-margin;
168 }
169
170 @if $column == 'column' and has-value($grid-column-alias) {
171 .#{$grid-column-alias} {
172 // sass-lint:disable-block placeholder-in-extend
173 @extend .column;
174 }
175 }
176}