forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrid.scss
More file actions
230 lines (168 loc) · 3.65 KB
/
grid.scss
File metadata and controls
230 lines (168 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
@import "../../themes/ionic.globals";
// Grid
// --------------------------------------------------
// Using flexbox for the grid, inspired by Philip Walton:
// http://philipwalton.github.io/solved-by-flexbox/demos/grids/
// By default each .col within a .row will evenly take up
// available width, and the height of each .col with take
// up the height of the tallest .col in the same .row.
$grid-padding-width: 10px !default;
$grid-responsive-sm-break: 567px !default; // smaller than landscape phone
$grid-responsive-md-break: 767px !default; // smaller than portrait tablet
$grid-responsive-lg-break: 1023px !default; // smaller than landscape tablet
@mixin responsive-grid-break($selector, $max-width) {
@media (max-width: $max-width) {
#{$selector} {
flex-direction: column;
ion-col {
&[width-10],
&[width-20],
&[width-25],
&[width-33],
&[width-34],
&[width-50],
&[width-66],
&[width-67],
&[width-75],
&[width-80],
&[width-90] {
flex: 1;
margin-bottom: ($grid-padding-width * 3) / 2;
margin-left: 0;
width: 100%;
max-width: 100%;
}
}
}
}
}
ion-grid {
display: flex;
flex-direction: column;
padding: ($grid-padding-width / 2);
width: 100%;
}
ion-row {
display: flex;
width: 100%;
&[wrap] {
flex-wrap: wrap;
}
&[top] {
align-items: flex-start;
}
&[bottom] {
align-items: flex-end;
}
&[center] {
align-items: center;
}
&[stretch] {
align-items: stretch;
}
&[baseline] {
align-items: baseline;
}
}
ion-col {
display: block;
flex: 1;
padding: ($grid-padding-width / 2);
width: 100%;
// Column Alignment
&[top] {
align-self: flex-start;
}
&[bottom] {
align-self: flex-end;
}
&[center] {
align-self: center;
}
&[stretch] {
align-self: stretch;
}
&[baseline] {
align-self: baseline;
}
// Column Offsets
&[offset-10] {
margin-left: 10%;
}
&[offset-20] {
margin-left: 20%;
}
&[offset-25] {
margin-left: 25%;
}
&[offset-33],
&[offset-34] {
margin-left: 33.3333%;
}
&[offset-50] {
margin-left: 50%;
}
&[offset-66],
&[offset-67] {
margin-left: 66.6666%;
}
&[offset-75] {
margin-left: 75%;
}
&[offset-80] {
margin-left: 80%;
}
&[offset-90] {
margin-left: 90%;
}
// Explicit Column Percent Sizes
// By default each grid column will evenly distribute
// across the grid. However, you can specify individual
// columns to take up a certain size of the available area
&[width-10] {
flex: 0 0 10%;
max-width: 10%;
}
&[width-20] {
flex: 0 0 20%;
max-width: 20%;
}
&[width-25] {
flex: 0 0 25%;
max-width: 25%;
}
&[width-33],
&[width-34] {
flex: 0 0 33.3333%;
max-width: 33.3333%;
}
&[width-50] {
flex: 0 0 50%;
max-width: 50%;
}
&[width-66],
&[width-67] {
flex: 0 0 66.6666%;
max-width: 66.6666%;
}
&[width-75] {
flex: 0 0 75%;
max-width: 75%;
}
&[width-80] {
flex: 0 0 80%;
max-width: 80%;
}
&[width-90] {
flex: 0 0 90%;
max-width: 90%;
}
}
// Responsive Grid Classes
// Adding a class of responsive-X to a row
// will trigger the width-direction to
// change to column and add some margin
// to any columns in the row for clearity
@include responsive-grid-break('[responsive-sm]', $grid-responsive-sm-break);
@include responsive-grid-break('[responsive-md]', $grid-responsive-md-break);
@include responsive-grid-break('[responsive-lg]', $grid-responsive-lg-break);