blob: c942ff1a811a9aca74390c08a5be9f7ccba2ac61 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001@charset "UTF-8";
2
3/**
4 * This code is modified from Material Design Lite _grid.sass,
5 * which is Licensed under the Apache License, Version 2.0
6 * Copyright 2015 Google Inc. All Rights Reserved.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 */
21
22///////////////////////////////////////////////////////////////////////
23//
24// Grid media queries, modified from Material Design Lite _grid.sass
25//
26///////////////////////////////////////////////////////////////////////
27// Use of this module requires the user to include variables from material-design-lite in hers/his main SASS module
28//@import "../../node_modules/material-design-lite/src/variables";
29
30
31.mdlext-grid {
32 display: flex;
33 flex-flow: row wrap;
34 margin: 0 auto;
35 align-items: stretch;
36
37 &.mdlext-grid--no-spacing {
38 padding: 0;
39 }
40}
41
42.mdlext-cell {
43 box-sizing: border-box;
44}
45
46
47.mdlext-cell--top {
48 align-self: flex-start;
49}
50
51.mdlext-cell--middle {
52 align-self: center;
53}
54
55.mdlext-cell--bottom {
56 align-self: flex-end;
57}
58
59.mdlext-cell--stretch {
60 align-self: stretch;
61}
62
63.mdlext-grid.mdlext-grid--no-spacing > .mdlext-cell {
64 margin: 0;
65}
66
67// Define order override classes.
68@for $i from 1 through $grid-max-columns {
69 .mdlext-cell--order-#{$i} {
70 order: $i;
71 }
72}
73
74
75// Mixins for width calculation.
76@mixin partial-size($size, $columns, $gutter) {
77 width: calc(#{(($size / $columns) * 100) + "%"} - #{$gutter});
78
79 .mdlext-grid--no-spacing > & {
80 width: #{(($size / $columns) * 100) + "%"};
81 }
82}
83
84@mixin full-size($gutter) {
85 @include partial-size(1, 1, $gutter);
86}
87
88@mixin offset-size($size, $columns, $gutter) {
89 margin-left: calc(#{(($size / $columns) * 100) + "%"} + #{$gutter / 2});
90
91 .mdlext-grid.mdlext-grid--no-spacing > & {
92 margin-left: #{(($size / $columns) * 100) + "%"};
93 }
94}
95
96
97
98////////// Phone //////////
99
100/* stylelint-disable */
101@media (max-width: $grid-tablet-breakpoint - 1) {
102/* stylelint-enable */
103 .mdlext-grid {
104 padding: $grid-phone-margin - ($grid-phone-gutter / 2);
105 }
106
107 .mdlext-cell {
108 margin: $grid-phone-gutter / 2;
109 @include partial-size($grid-cell-default-columns, $grid-phone-columns, $grid-phone-gutter);
110 }
111
112 .mdlext-cell--hide-phone {
113 display: none !important;
114 }
115
116 // Define order override classes.
117 @for $i from 1 through $grid-max-columns {
118 .mdlext-cell--order-#{$i}-phone.mdlext-cell--order-#{$i}-phone {
119 order: $i;
120 }
121 }
122
123 // Define partial sizes for columnNumber < totalColumns.
124 @for $i from 1 through ($grid-phone-columns - 1) {
125 .mdlext-cell--#{$i}-col,
126 .mdlext-cell--#{$i}-col-phone.mdlext-cell--#{$i}-col-phone {
127 @include partial-size($i, $grid-phone-columns, $grid-phone-gutter);
128 }
129 }
130
131 // Define 100% for everything else.
132 @for $i from $grid-phone-columns through $grid-desktop-columns {
133 .mdlext-cell--#{$i}-col,
134 .mdlext-cell--#{$i}-col-phone.mdlext-cell--#{$i}-col-phone {
135 @include full-size($grid-phone-gutter);
136 }
137 }
138
139 // Define valid phone offsets.
140 @for $i from 1 through ($grid-phone-columns - 1) {
141 .mdlext-cell--#{$i}-offset,
142 .mdlext-cell--#{$i}-offset-phone.mdlext-cell--#{$i}-offset-phone {
143 @include offset-size($i, $grid-phone-columns, $grid-phone-gutter);
144 }
145 }
146}
147
148
149////////// Tablet //////////
150
151/* stylelint-disable */
152@media (min-width: $grid-tablet-breakpoint) and (max-width: $grid-desktop-breakpoint - 1) { /* stylelint-enable */
153 .mdlext-grid {
154 padding: $grid-tablet-margin - ($grid-tablet-gutter / 2);
155 }
156
157 .mdlext-cell {
158 margin: $grid-tablet-gutter / 2;
159 @include partial-size($grid-cell-default-columns, $grid-tablet-columns, $grid-tablet-gutter);
160 }
161
162 .mdlext-cell--hide-tablet {
163 display: none !important;
164 }
165
166 // Define order override classes.
167 @for $i from 1 through $grid-max-columns {
168 .mdlext-cell--order-#{$i}-tablet.mdlext-cell--order-#{$i}-tablet {
169 order: $i;
170 }
171 }
172
173 // Define partial sizes for columnNumber < totalColumns.
174 @for $i from 1 through ($grid-tablet-columns - 1) {
175 .mdlext-cell--#{$i}-col,
176 .mdlext-cell--#{$i}-col-tablet.mdlext-cell--#{$i}-col-tablet {
177 @include partial-size($i, $grid-tablet-columns, $grid-tablet-gutter);
178 }
179 }
180
181 // Define 100% for everything else.
182 @for $i from $grid-tablet-columns through $grid-desktop-columns {
183 .mdlext-cell--#{$i}-col,
184 .mdlext-cell--#{$i}-col-tablet.mdlext-cell--#{$i}-col-tablet {
185 @include full-size($grid-tablet-gutter);
186 }
187 }
188
189 // Define valid tablet offsets.
190 @for $i from 1 through ($grid-tablet-columns - 1) {
191 .mdlext-cell--#{$i}-offset,
192 .mdlext-cell--#{$i}-offset-tablet.mdlext-cell--#{$i}-offset-tablet {
193 @include offset-size($i, $grid-tablet-columns, $grid-tablet-gutter);
194 }
195 }
196}
197
198
199////////// Desktop //////////
200
201@media (min-width: $grid-desktop-breakpoint) {
202 .mdlext-grid {
203 padding: $grid-desktop-margin - ($grid-desktop-gutter / 2);
204 }
205
206 .mdlext-cell {
207 margin: $grid-desktop-gutter / 2;
208 @include partial-size($grid-cell-default-columns, $grid-desktop-columns, $grid-desktop-gutter);
209 }
210
211 .mdlext-cell--hide-desktop {
212 display: none !important;
213 }
214
215 // Define order override classes.
216 @for $i from 1 through $grid-max-columns {
217 .mdlext-cell--order-#{$i}-desktop.mdlext-cell--order-#{$i}-desktop {
218 order: $i;
219 }
220 }
221
222 // Define partial sizes for all numbers of columns.
223 @for $i from 1 through $grid-desktop-columns {
224 .mdlext-cell--#{$i}-col,
225 .mdlext-cell--#{$i}-col-desktop.mdlext-cell--#{$i}-col-desktop {
226 @include partial-size($i, $grid-desktop-columns, $grid-desktop-gutter);
227 }
228 }
229
230 // Define valid desktop offsets.
231 @for $i from 1 through ($grid-desktop-columns - 1) {
232 .mdlext-cell--#{$i}-offset,
233 .mdlext-cell--#{$i}-offset-desktop.mdlext-cell--#{$i}-offset-desktop {
234 @include offset-size($i, $grid-desktop-columns, $grid-desktop-gutter);
235 }
236 }
237}
238