-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.html
371 lines (340 loc) · 21.9 KB
/
index.html
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html ng-app="cssGridCC">
<head>
<title>CSS Grid Cheat Sheet</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="assets/css/styles.css" rel="stylesheet" type="text/css">
</head>
<body class="loading">
<div class="loading_overlay">
<div class="progress">
<div class="indeterminate"></div>
</div>
</div>
<div ng-controller="CSSGridController as CSSGrid">
<header>
<div id="sidebar">
<h1>CSS Grid Cheat Sheet <span>Your ultimate CSS grid visual guide</span></h1>
<div class="prop">
<div class="switch">
<label>
Guids
<input type="checkbox" ng-model="CSSGrid.guids">
<span class="lever"></span>
</label>
<input type="checkbox" id="expermental_guids" ng-model="CSSGrid.expermental_guids" />
<label for="expermental_guids">Experimental <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Looks visually better however it does not currently work on all situations. Turn off if the lines look off.">info_outline</i></label>
</div>
</div>
<div class="column_rows prop">
<label>grid-template-columns <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Defines the columns of the grid with a space-separated list of values. The values represent the track size, and the space between them represents the grid line.">info_outline</i></label>
<div class="row labels">
<div class="input-field col s4">
<label>Value</label>
</div>
<div class="input-field col s4">
<label>Unit</label>
</div>
<div class="input-field col s4">
<label>Repeat</label>
</div>
</div>
<ul dnd-list="CSSGrid.grid_template_columns_arr">
<li ng-repeat="column in CSSGrid.grid_template_columns_arr"
dnd-draggable="column"
dnd-moved="CSSGrid.grid_template_columns_arr.splice($index, 1); CSSGrid.creatColumnsString(); CSSGrid.creatRowsString()"
dnd-effect-allowed="move"
>
<dnd-nodrag>
<div dnd-handle class="handle"> <i class="tiny material-icons">drag_handle</i></div>
<div class="remove" ng-if="CSSGrid.grid_template_columns_arr.length > 1" ng-click="CSSGrid.removeColumn($index)"><i class="tiny material-icons">remove_circle</i></div>
<div class="row">
<div class="input-field col s4">
<input type="number" min="0" ng-model="column.value" ng-change="CSSGrid.creatColumnsString();">
</div>
<div class="input-field col s4">
<select ng-model="column.unit" ng-change="CSSGrid.creatColumnsString();">
<option value="px" selected>px</option>
<option value="fr">fr</option>
<option value="%">%</option>
</select>
</div>
<div class="input-field col s4">
<input type="number" min="1" ng-model="column.repeat" ng-change="CSSGrid.creatColumnsString();">
</div>
</div>
</dnd-nodrag>
</li>
</ul>
<div class="output">{{CSSGrid.grid_template_columns}} <br> <a ng-click="CSSGrid.addColumn()" class="waves-effect waves-light btn"><i class="material-icons left">add</i>Add Column</a></div>
</div>
<div class="column_rows prop">
<label>grid-template-rows <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Defines the rows of the grid with a space-separated list of values. The values represent the track size, and the space between them represents the grid line.">info_outline</i></label>
<div class="row labels">
<div class="input-field col s4">
<label>Value</label>
</div>
<div class="input-field col s4">
<label>Unit</label>
</div>
<div class="input-field col s4">
<label>Repeat</label>
</div>
</div>
<ul dnd-list="CSSGrid.grid_template_rows_arr">
<li ng-repeat="row in CSSGrid.grid_template_rows_arr"
dnd-draggable="row"
dnd-moved="CSSGrid.grid_template_rows_arr.splice($index, 1); CSSGrid.creatColumnsString(); CSSGrid.creatRowsString()"
dnd-effect-allowed="move"
>
<dnd-nodrag>
<div dnd-handle class="handle"> <i class="tiny material-icons">drag_handle</i></div>
<div class="remove" ng-if="CSSGrid.grid_template_rows_arr.length > 1" ng-click="CSSGrid.removeRow($index)"><i class="tiny material-icons">remove_circle</i></div>
<div class="row">
<div class="input-field col s4">
<input type="number" min="0" ng-model="row.value" ng-change="CSSGrid.creatRowsString();">
</div>
<div class="input-field col s4">
<select ng-model="row.unit" ng-change="CSSGrid.creatRowsString();">
<option value="px" selected>px</option>
<option value="fr">fr</option>
<option value="%">%</option>
</select>
</div>
<div class="input-field col s4">
<input type="number" min="1" ng-model="row.repeat" ng-change="CSSGrid.creatRowsString();">
</div>
</div>
</dnd-nodrag>
</li>
</ul>
<div class="output">{{CSSGrid.grid_template_rows}} <br> <a ng-click="CSSGrid.addRow()" class="waves-effect waves-light btn"><i class="material-icons left">add</i>Add Row</a></div>
</div>
<div class="prop">
<div class="input-field">
<label>Container Height <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Leave empty for 'auto'.">info_outline</i></label>
<input type="number" min="0" ng-change="CSSGrid.updateGhosts();" ng-model="CSSGrid.container_height">
</div>
</div>
<div class="prop">
<div class="input-field">
<label>grid-column-gap <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Specifies the size of the grid lines. You can think of it like setting the width of the gutters between the columns.">info_outline</i></label>
<input type="number" min="0" ng-model="CSSGrid.grid_column_gap">
</div>
</div>
<div class="prop">
<div class="input-field">
<label>grid-row-gap <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Specifies the size of the grid lines. You can think of it like setting the width of the gutters between the rows.">info_outline</i></label>
<input type="number" min="0" ng-model="CSSGrid.grid_row_gap">
</div>
</div>
<div class="prop">
<div class="input-field">
<label>justify-items <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Aligns the content inside a grid item along the row axis.">info_outline</i></label>
<select ng-model="CSSGrid.justify_items">
<option value="start" selected>start</option>
<option value="end">end</option>
<option value="center">center</option>
<option value="stretch">stretch</option>
</select>
</div>
</div>
<div class="prop">
<div class="input-field">
<label>align-items <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Aligns the content inside a grid item along the column axis.">info_outline</i></label>
<select ng-model="CSSGrid.align_items">
<option value="start" selected>start</option>
<option value="end">end</option>
<option value="center">center</option>
<option value="stretch">stretch</option>
</select>
</div>
</div>
<div class="prop">
<div class="input-field">
<label>justify-content <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Sometimes the total size of your grid might be less than the size of its grid container. This could happen if all of your grid items are sized with non-flexible units like px. In this case you can set the alignment of the grid within the grid container. This property aligns the grid along the row axis.">info_outline</i></label>
<select ng-model="CSSGrid.justify_content">
<option value="start" selected>start</option>
<option value="end">end</option>
<option value="center">center</option>
<option value="stretch">stretch</option>
<option value="space-around">space-around</option>
<option value="space-between">space-between</option>
<option value="space-evenly">space-evenly</option>
</select>
</div>
</div>
<div class="prop">
<div class="input-field">
<label>align-content <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Sometimes the total size of your grid might be less than the size of its grid container. This could happen if all of your grid items are sized with non-flexible units like px. In this case you can set the alignment of the grid within the grid container. This property aligns the grid along the column axis.">info_outline</i></label>
<select ng-model="CSSGrid.align_content">
<option value="start" selected>start</option>
<option value="end">end</option>
<option value="center">center</option>
<option value="stretch">stretch</option>
<option value="space-around">space-around</option>
<option value="space-between">space-between</option>
<option value="space-evenly">space-evenly</option>
</select>
</div>
</div>
<div class="prop">
<label>grid-auto-columns <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Specifies the size of any auto-generated grid tracks (aka implicit grid tracks). Implicit grid tracks get created when you explicitly position rows or columns (via grid-template-rows/grid-template-columns) that are out of range of the defined grid.">info_outline</i></label>
<div class="row">
<div class="input-field col s6">
<input type="number" min="0" ng-model="CSSGrid.grid_auto_columns.value">
</div>
<div class="input-field col s6">
<select ng-model="CSSGrid.grid_auto_columns.unit">
<option value="px" selected>px</option>
<option value="fr">fr</option>
<option value="%">%</option>
</select>
</div>
</div>
</div>
<div class="prop">
<label>grid-auto-rows <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Specifies the size of any auto-generated grid tracks (aka implicit grid tracks). Implicit grid tracks get created when you explicitly position rows or columns (via grid-template-rows/grid-template-columns) that are out of range of the defined grid.">info_outline</i></label>
<div class="row">
<div class="input-field col s6">
<input type="number" min="0" ng-model="CSSGrid.grid_auto_rows.value">
</div>
<div class="input-field col s6">
<select ng-model="CSSGrid.grid_auto_rows.unit">
<option value="px" selected>px</option>
<option value="fr">fr</option>
<option value="%">%</option>
</select>
</div>
</div>
</div>
<div class="prop">
<div class="input-field">
<label>grid-auto-flow <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="If you have grid items that you don't explicitly place on the grid, the auto-placement algorithm kicks in to automatically place the items. This property controls how the auto-placement algorithm works.">info_outline</i></label>
<select ng-model="CSSGrid.grid_auto_flow">
<option value="row" selected>row</option>
<option value="column">column</option>
<!-- <option value="dense">dense</option> -->
</select>
</div>
</div>
<div class="footer">
Created by <a target="_blank" href="https://twitter.com/alialaa">@alialaa</a>.
View on <a target="_blank" href="https://github.com/alialaa/css-grid-cheat-sheet">Github</a> <br>
Properties info text from <a target="_blank" href="https://css-tricks.com/snippets/css/complete-guide-grid/">css-tricks.com</a>
</div>
</div>
<div id="item_props" ng-class="{'active': CSSGrid.selected_item !== -1}" ng-style="{'background-color': '#'+CSSGrid.items[CSSGrid.selected_item].colour}">
<a class="close" ng-click="CSSGrid.selected_item = -1;"><i class="tiny material-icons">close</i></a>
<div class="prop">
<label>grid-column-start <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Determines a grid item's location within the grid by referring to specific grid lines. grid-column-start is the line where the item begins.">info_outline</i></label>
<div class="row">
<div class="input-field col s6">
<select ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-column-start']['type']">
<option value="auto" selected>Auto</option>
<option value="line">Line Number</option>
<option value="span">Span</option>
</select>
</div>
<div class="input-field col s6">
<input type="number" min="1" ng-disabled="CSSGrid.items[CSSGrid.selected_item]['grid-column-start']['type'] == 'auto'" ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-column-start']['value']">
</div>
</div>
</div>
<div class="prop">
<label>grid-column-end <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Determines a grid item's location within the grid by referring to specific grid lines. grid-column-end is the line where the item ends.">info_outline</i></label>
<div class="row">
<div class="input-field col s6">
<select ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-column-end']['type']">
<option value="auto" selected>Auto</option>
<option value="line">Line Number</option>
<option value="span">Span</option>
</select>
</div>
<div class="input-field col s6">
<input type="number" min="1" ng-disabled="CSSGrid.items[CSSGrid.selected_item]['grid-column-end']['type'] == 'auto'" ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-column-end']['value']">
</div>
</div>
</div>
<div class="prop">
<label>grid-row-start <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Determines a grid item's location within the grid by referring to specific grid lines. grid-row-start is the line where the item begins.">info_outline</i></label>
<div class="row">
<div class="input-field col s6">
<select ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-row-start']['type']">
<option value="auto" selected>Auto</option>
<option value="line">Line Number</option>
<option value="span">Span</option>
</select>
</div>
<div class="input-field col s6">
<input type="number" min="1" ng-disabled="CSSGrid.items[CSSGrid.selected_item]['grid-row-start']['type'] == 'auto'" ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-row-start']['value']">
</div>
</div>
</div>
<div class="prop">
<label>grid-row-end <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Determines a grid item's location within the grid by referring to specific grid lines. grid-row-end is the line where the item ends.">info_outline</i></label>
<div class="row">
<div class="input-field col s6">
<select ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-row-end']['type']">
<option value="auto" selected>Auto</option>
<option value="line">Line Number</option>
<option value="span">Span</option>
</select>
</div>
<div class="input-field col s6">
<input type="number" min="1" ng-disabled="CSSGrid.items[CSSGrid.selected_item]['grid-row-end']['type'] == 'auto'" ng-model="CSSGrid.items[CSSGrid.selected_item]['grid-row-end']['value']">
</div>
</div>
</div>
<div class="prop">
<label>justify-self <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Aligns the content inside a grid item along the row axis (as opposed to align-self which aligns along the column axis). This value applies to the content inside a single grid item.">info_outline</i></label>
<select ng-model="CSSGrid.items[CSSGrid.selected_item]['justify-self']">
<option value="auto">auto</option>
<option value="start">start</option>
<option value="end">end</option>
<option value="center">center</option>
<option value="stretch">stretch</option>
</select>
</div>
<div class="prop">
<label>align-self <i class="tooltipped tiny material-icons" data-position="right" data-delay="50" data-tooltip="Aligns the content inside a grid item along the column axis (as opposed to justify-self which aligns along the row axis). This value applies to the content inside a single grid item.">info_outline</i></label>
<select ng-model="CSSGrid.items[CSSGrid.selected_item]['align-self']">
<option value="auto">auto</option>
<option value="start">start</option>
<option value="end">end</option>
<option value="center">center</option>
<option value="stretch">stretch</option>
</select>
</div>
</div>
</header>
<main ng-class="{'hidden': !CSSGrid.container_height }">
<div class="fixed-action-btn">
<a ng-click="CSSGrid.createNewItem()" class="btn-floating btn-large waves-effect waves-light red tooltipped" data-position="left" data-delay="50" data-tooltip="Add an Item"><i class="material-icons">add</i></a>
</div>
<div class="css_grid ghost" ng-if="CSSGrid.guids && CSSGrid.expermental_guids" ng-style="{'height': CSSGrid.container_height ? CSSGrid.container_height + 'px' : 'auto', 'grid-template-columns': CSSGrid.extra_left_cols_text + CSSGrid.grid_template_columns + CSSGrid.extra_right_cols_text, 'grid-template-rows': CSSGrid.extra_top_rows_text + CSSGrid.grid_template_rows, 'grid-row-gap': CSSGrid.grid_row_gap, 'grid-column-gap': CSSGrid.grid_column_gap, 'justify-content': CSSGrid.justify_content, 'align-content': CSSGrid.align_content, 'grid-auto-columns': CSSGrid.grid_auto_columns.value + CSSGrid.grid_auto_columns.unit, 'grid-auto-rows': CSSGrid.grid_auto_rows.value + CSSGrid.grid_auto_rows.unit}">
<div class="css_grid_item" ng-repeat="item in CSSGrid.ghosts track by $index">
<div class="css_grid_inner">{{$index+1}}</div>
<div class="left line" ></div><div class="right line" ></div>
<div class="top line" ></div><div class="bottom line" ></div>
</div>
</div>
<div class="css_grid ghost_alt" ng-if="CSSGrid.guids && !CSSGrid.expermental_guids" ng-style="{'height': CSSGrid.container_height ? CSSGrid.container_height + 'px' : 'auto', 'grid-template-columns':CSSGrid.grid_template_columns, 'grid-template-rows': CSSGrid.grid_template_rows, 'grid-row-gap': CSSGrid.grid_row_gap, 'grid-column-gap': CSSGrid.grid_column_gap, 'justify-content': CSSGrid.justify_content, 'align-content': CSSGrid.align_content, 'grid-auto-columns': CSSGrid.grid_auto_columns.value + CSSGrid.grid_auto_columns.unit, 'grid-auto-rows': CSSGrid.grid_auto_rows.value + CSSGrid.grid_auto_rows.unit, 'grid-auto-flow': CSSGrid.grid_auto_flow}">
<div class="css_grid_item" ng-repeat="item in CSSGrid.items" ng-style="{'grid-column-start': CSSGrid.getGridItemValue(item['grid-column-start']) ,'grid-column-end': CSSGrid.getGridItemValue(item['grid-column-end']),'grid-row-start': CSSGrid.getGridItemValue(item['grid-row-start']),'grid-row-end': CSSGrid.getGridItemValue(item['grid-row-end'])}">
<div class="css_grid_inner">{{$index+1}}</div>
<div class="left line" ></div><div class="right line" ></div>
<div class="top line" ></div><div class="bottom line" ></div>
</div>
</div>
<div class="css_grid" ng-class="{'item_selected': CSSGrid.selected_item !== -1}" ng-style="{'height': CSSGrid.container_height ? CSSGrid.container_height + 'px' : 'auto', 'grid-template-columns': CSSGrid.grid_template_columns, 'grid-template-rows': CSSGrid.grid_template_rows, 'grid-row-gap': CSSGrid.grid_row_gap, 'grid-column-gap': CSSGrid.grid_column_gap,'justify-items': CSSGrid.justify_items,'align-items': CSSGrid.align_items, 'justify-content': CSSGrid.justify_content, 'align-content': CSSGrid.align_content, 'grid-auto-columns': CSSGrid.grid_auto_columns.value + CSSGrid.grid_auto_columns.unit, 'grid-auto-rows': CSSGrid.grid_auto_rows.value + CSSGrid.grid_auto_rows.unit, 'grid-auto-flow': CSSGrid.grid_auto_flow}">
<div class="css_grid_item waves-effect waves-light" ng-class="{'selected': CSSGrid.selected_item == $index}" ng-click="CSSGrid.toggleItem($index);" ng-repeat="item in CSSGrid.items" ng-style="{'background-color': '#'+item.colour, 'border': '1px solid ' + '#'+item.colour, 'grid-column-start': CSSGrid.getGridItemValue(item['grid-column-start']) ,'grid-column-end': CSSGrid.getGridItemValue(item['grid-column-end']),'grid-row-start': CSSGrid.getGridItemValue(item['grid-row-start']),'grid-row-end': CSSGrid.getGridItemValue(item['grid-row-end']),'justify-self': item['justify-self'],'align-self': item['align-self']}">
<div class="css_grid_inner">{{$index+1}}</div>
<div class="remove" ng-if="CSSGrid.items.length > 1" ng-click="CSSGrid.removeItem($index)"><i class="tiny material-icons" title="Remove">remove_circle</i></div>
</div>
</div>
</main>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="assets/js/script.min.js"></script>
</body>
</html>