This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
656 lines (626 loc) · 25.5 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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grid layout</title>
<link rel="stylesheet" href="css/neptune.css">
<link rel="stylesheet" href="css/grid-layout.css">
<link rel="stylesheet" href="css/docs.css">
</head>
<body>
<section class="doc-grid-layout grid-sidebar section">
<nav>
<ul class="doc-menu">
<li>
<a href="#general-usage">General usage</a>
</li>
<li>
<a href="#container">Container</a>
</li>
<li>
<a href="#responsive-columns">Responsive columns</a>
</li>
<li>
<a href="#nesting">Nesting grids</a>
</li>
<li>
<a href="#rows">Rows</a>
</li>
<li>
<a href="#gap">Gap</a>
</li>
<li>
<a href="#reverse">Reverse</a>
</li>
<li>
<a href="#order">Ordering</a>
</li>
<li>
<a href="#alignment">Aligment</a>
</li>
<li>
<a href="#common-patterns">Common patterns</a>
</li>
</ul>
<p class="m-l-4">Archive</p>
<ul>
<li>
<a href="#columns">Grid Layout in Neptune</a>
</li>
<li>
<a href="#bootstrap">Bootstrap cols</a>
</li>
</ul>
</nav>
<div class="container">
<h1 class="colored-dot">Grid Layout system. v0</h1>
<p>⚠️ This is a creation playground. Still in building process.</p>
<h2>Objetives:</h2>
<ul>
<li>Take advantage of new grid layout features to apply it in our products.</li>
<li>Build an stable layout system, with nice fallback for unsupported browsers, to create the column
layout and some reusable patterns.</li>
<li>Replace the Bootstrap cols system, instead of using both.</li>
<li>Document the process of learnings.</li>
</ul>
<div class="grid-2 gap">
<div>
<h3>Pros</h3>
<ul>
<li>Simple to use</li>
<li>Custom system to our needs. Flexible</li>
<li>Easy reverse and ordering</li>
<li>Less code. Simple DOM and lighter CSS</li>
<li>Use of standard and modern code</li>
<li>Can be used with other layout systems. It's not exclusive.</li>
</ul>
</div>
<div>
<h3>Cons</h3>
<ul>
<li>Not supported in IE11. Need fallback</li>
<li>Have to learn something new</li>
<li>It's something we don´t need in fact. It's an improvement</li>
</ul>
</div>
</div>
<p>Want to know more about grid layout?
<a href="https://css-tricks.com/snippets/css/complete-guide-grid/" target="_blank"
rel="noopener noreferrer">Here a complete guide</a></p>
<h2 id="general-usage">General usage</h2>
<ul>
<li>The columns are defined in the <strong>parent component</strong>.</li>
<li>The grid classes can be applied to the <code>.container</code> element.</li>
<li>Firefox dev tools work amazing for grid creation.</li>
</ul>
<pre>
<div class="container grid-2">
<div>...</div>
<div>...</div>
</div>
</pre>
<p>Ordering is applied to the child item.</p>
<h2 id="container">Container</h2>
<h3>.container</h3>
<p>This is the same container we use currently in Neptune.
</p>
<pre>
<div class="container">
...
</div>
</pre>
<div class="container item">...</div>
<h3 class="">.container-10</h3>
<p>This gets the same result as tipical .col-md-10 .col-md-offset-1 from Bootstrap</p>
<p class="alert alert-warning">Need a semantic name for this?</p>
<pre>
<div class="container-10">
...
</div>
</pre>
<div class="container-10">
<div class="item">This is some content</div>
<div class="item">This is some content</div>
<div class="item">This is some content</div>
</div>
<h3 class="">.container-10--md</h3>
<p>If you need this layout only for desktop. Use this case.</p>
<div class="container-10--md">
<div class="item">This is some content</div>
<div class="item">This is some content</div>
<div class="item">This is some content</div>
</div>
<h3 class="">Example with Bootstrap grid: .col-md-10 .col-md-offset-1</h3>
<p>The boostrap system has a horizontal margin: -12px in the row, that's why it is a bit wider. </p>
<div class="row">
<div class="item col-md-10 col-md-offset-1">
This is some content
</div>
</div>
<h3 class="">.container-8</h3>
<div class="container-8">
<div class="item">This is some content</div>
<div class="item">This is some content</div>
<div class="item">This is some content</div>
</div>
<h3 class="">.container-8--md</h3>
<div class="container-8--md">
<div class="item">This is some content</div>
<div class="item">This is some content</div>
<div class="item">This is some content</div>
</div>
<h3 class="">Example with Bootstrap grid: .col-md-8 .col-md-offset-2</h3>
<div class="row">
<div class="item col-md-8 col-md-offset-2">
This is some content
</div>
</div>
<h2 id="responsive-columns">Responsive columns</h2>
<p>Basic simple system</p>
<span class="badge badge-success">IE11 friendly</span>
<h3>.grid-2</h3>
<pre>
<div class="grid-2">
<div>...</div>
<div>...</div>
</div></pre>
<div class="grid-2">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-2--sm</h3>
<div class="grid-2--sm">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-2--md</h3>
<div class="grid-2--md">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-2--lg</h3>
<div class="grid-2--lg">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-3</h3>
<div class="grid-3">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-3--sm</h3>
<div class="grid-3--sm">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-3--md</h3>
<div class="grid-3--md">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-3--lg</h3>
<div class="grid-3--lg">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-4</h3>
<div class="grid-4">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-4--sm</h3>
<div class="grid-4--sm">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-4--md</h3>
<div class="grid-4--md">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>.grid-4--lg</h3>
<div class="grid-4--lg">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3>Combined: .grid-2 .grid-3--md .grid-4--lg</h3>
<div class="grid-2 grid-3--md grid-4--lg">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 id="nesting">Nesting grids</h2>
<p>It's totally fine to nest grids</p>
<pre>
<div class="grid-2 gap">
<div>...
<div class="grid-2">
<div>...</div>
<div>...</div>
</div>
</div>
<div>...</div>
</div>
</pre>
<div class="grid-2 gap">
<div class="item">Item
<div class="grid-2">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
</div>
<div class="item">Item</div>
</div>
<pre class="m-t-4">
<div class="container-8 grid-2">
<div>...
<div class="grid-2--md gap">
<div>...</div>
<div>...</div>
</div>
</div>
<div>...</div>
</div>
</pre>
<div class="container-8 grid-2">
<div class="item">Item
<div class="grid-2--md gap">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
</div>
<div class="item">Item</div>
</div>
<h2 id="rows">Rows</h2>
<p>The rows are autoplaced. You don´t have to do anything.</p>
<pre>
<div class="grid-3">
<div>...</div>
<div>...</div>
<div>...</div>
<div>...</div>
</div>
</pre>
<h3>.grid-3</h3>
<div class="grid-3">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 id="gap" class="">Gap</h2>
<ul>
<li>The <strong>default</strong> --gap is <strong>--space-16</strong> for mobile,
<strong>--space-24</strong> for desktop</li>
<li>The <strong>column</strong> --gap is <strong>1/12</strong>. More or less as a Bootstrap col size.
</li>
</ul>
<pre>
<div class="grid-2 gap">
<div>...</div>
<div>...</div>
</div></pre>
<h3 class="">.gap</h3>
<p>The default gap is for both columns and rows.</p>
<div class="grid-2 gap">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.gap--32</h3>
<div class="grid-2 gap--32">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.gap--column</h3>
<p>Gap only for columns. The space is 1/12</p>
<pre>
:root {
--gap: calc(100% / 12);
}
</pre>
<div class="grid-2 gap--column">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 id="reverse" class="">Reverse</h2>
<p>The reverse mode is only horizontal (by now).</p>
<h3>.reverse</h3>
<pre>
<div class="grid-<i>n</i> reverse">
<div>...</div>
<div>...</div>
</div></pre>
<div class="grid-2 reverse">
<span class="item">1 item</span>
<span class="item">2 item</span>
</div>
<div class="grid-3 reverse">
<span class="item">1 item</span>
<span class="item">2 item</span>
<span class="item">3 item</span>
</div>
<div class="grid-4 reverse">
<span class="item">1 item</span>
<span class="item">2 item</span>
<span class="item">3 item</span>
<span class="item">4 item</span>
</div>
<h2 id="order">Ordering</h2>
<p>The class must be added to the <strong>child item</strong></p>
<h3>.order-1--mobile</h3>
<pre>
<div class="grid-4--md">
<div>...</div>
<div>...</div>
<div class="order-1--mobile">...</div>
<div>...</div>
</div></pre>
<div class="grid-4--md">
<span class="item">1 item</span>
<span class="item">2 item</span>
<span class="item order-1--mobile highlight">3 item. I want to be first on mobile</span>
<span class="item">4 item</span>
</div>
<h2 id="alignment" class="">Alignment</h2>
<h3>.align-items--start</h3>
<div class="grid-2 align-items--start">
<div class="item">This is some content</div>
<div class="item">
This is some content. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Sed tempor, lacus vel consequat viverra, tellus orci
aliquet ante, sed lacinia orci orci in dui. Pellentesque pellentesque
ultricies ex, ut faucibus orci finibus non. Phasellus blandit laoreet
eros, eget mattis sem lacinia vitae. Nam dignissim viverra metus et
tincidunt. Vestibulum eu nibh molestie, mattis nisl ut, scelerisque
erat. Sed vitae est at quam vulputate congue sit amet a sapien. Ut
eleifend cursus ex. In in nulla vitae ex viverra eleifend vitae et
lectus. In aliquam, eros sit amet scelerisque laoreet, purus risus
gravida ante, sit amet porttitor est nulla et nisi. Duis tempus magna
enim, et condimentum ipsum iaculis vel. Cras eget consectetur sem.
Pellentesque pretium enim a metus laoreet, sit amet interdum orci
vestibulum. Aliquam ut dolor at leo consectetur scelerisque.{" "}
</div>
</div>
<h3>.align-items--center</h3>
<div class="grid-2 align-items--center">
<div class="item">This is some content</div>
<div class="item">
This is some content. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Sed tempor, lacus vel consequat viverra, tellus orci
aliquet ante, sed lacinia orci orci in dui. Pellentesque pellentesque
ultricies ex, ut faucibus orci finibus non. Phasellus blandit laoreet
eros, eget mattis sem lacinia vitae. Nam dignissim viverra metus et
tincidunt. Vestibulum eu nibh molestie, mattis nisl ut, scelerisque
erat. Sed vitae est at quam vulputate congue sit amet a sapien. Ut
eleifend cursus ex. In in nulla vitae ex viverra eleifend vitae et
lectus. In aliquam, eros sit amet scelerisque laoreet, purus risus
gravida ante, sit amet porttitor est nulla et nisi. Duis tempus magna
enim, et condimentum ipsum iaculis vel. Cras eget consectetur sem.
Pellentesque pretium enim a metus laoreet, sit amet interdum orci
vestibulum. Aliquam ut dolor at leo consectetur scelerisque.{" "}
</div>
</div>
<h2 id="common-patterns">Common patterns</h2>
<p>Do we have common layout patterns?</p>
<h3>.grid-sidebar</h3>
<pre>
<div class="grid-sidebar">
<div>...</div>
<div>...</div>
</div></pre>
<div class="grid-sidebar">
<div class="item"></div>
<div class="item"></div>
</div>
<h2 id="columns">Grid Layout in current Neptune CSS</h2>
<p class="alert alert-danger">Need to review. Select the useful combinations</p>
<h3>.d-grid .grid--1-1</h3>
<div class="d-grid grid--1-1">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-1-1</h3>
<div class="d-grid grid--1-1-1">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-1-1-1</h3>
<div class="d-grid grid--1-1-1-1">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-1-1-1-1</h3>
<div class="d-grid grid--1-1-1-1-1">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 class="">5 fractions</h2>
<h3 class="">.d-grid .grid--4-1</h3>
<div class="d-grid grid--4-1">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--3-2</h3>
<div class="d-grid grid--3-2">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--2-3</h3>
<div class="d-grid grid--2-3">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-4</h3>
<div class="d-grid grid--1-4">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-3-1</h3>
<div class="d-grid grid--1-3-1">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 class="">4 fractions</h2>
<h3 class="">.d-grid .grid--3-1</h3>
<div class="d-grid grid--3-1">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-3</h3>
<div class="d-grid grid--1-3">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-2-1</h3>
<div class="d-grid grid--1-2-1">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 class="">3 fractions</h2>
<h3 class="">.d-grid .grid--2-1</h3>
<div class="d-grid grid--2-1">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h3 class="">.d-grid .grid--1-2</h3>
<div class="d-grid grid--1-2">
<div class="item">Item</div>
<div class="item">Item</div>
</div>
<h2 id="bootstrap" class=" colored-dot">Bootstrap col system</h2>
<div class="row">
<div class="item col-md-1">.col-md-1</div>
</div>
<div class="row">
<div class="item col-md-2">.col-md-2</div>
</div>
<div class="row">
<div class="item col-md-3">.col-md-3</div>
</div>
<div class="row">
<div class="item col-md-4">.col-md-4</div>
</div>
<div class="row">
<div class="item col-md-5">.col-md-5</div>
</div>
<div class="row">
<div class="item col-md-6">.col-md-6</div>
</div>
<div class="row">
<div class="item col-md-7">.col-md-7</div>
</div>
<div class="row">
<div class="item col-md-8">.col-md-8</div>
</div>
<div class="row">
<div class="item col-md-9">.col-md-9</div>
</div>
<div class="row">
<div class="item col-md-10">.col-md-10</div>
</div>
<div class="row">
<div class="item col-md-11">.col-md-11</div>
</div>
<div class="row">
<div class="item col-md-12">.col-md-12</div>
</div>
<div class="row">
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
<div class="item col-md-1">.col-md-1</div>
</div>
<div class="row">
<div class="item col-md-8">.col-md-8</div>
<div class="item col-md-4">.col-md-4</div>
</div>
<div class="row">
<div class="item col-md-4">.col-md-4</div>
<div class="item col-md-4">.col-md-4</div>
<div class="item col-md-4">.col-md-4</div>
</div>
<div class="row">
<div class="item col-md-6">.col-md-6</div>
<div class="item col-md-6">.col-md-6</div>
</div>
<div class="row">
<div class="item col-md-2">.col-md-2</div>
<div class="item col-md-5">.col-md-5</div>
<div class="item col-md-5">.col-md-5</div>
</div>
<h2 class="">Use of the offset</h2>
<div class="row">
<div class="item col-md-1 col-md-offset-11">
.col-md-1 .col-md-offset-11
</div>
<div class="item col-md-2 col-md-offset-10">
.col-md-2 .col-md-offset-10
</div>
<div class="item col-md-3 col-md-offset-9">
.col-md-3 .col-md-offset-9
</div>
<div class="item col-md-4 col-md-offset-8">
.col-md-4 .col-md-offset-8
</div>
<div class="item col-md-5 col-md-offset-7">
.col-md-5 .col-md-offset-7
</div>
<div class="item col-md-6 col-md-offset-6">
.col-md-6 .col-md-offset-6
</div>
<div class="item col-md-7 col-md-offset-5">
.col-md-7 .col-md-offset-5
</div>
<div class="item col-md-8 col-md-offset-4">
.col-md-8 .col-md-offset-4
</div>
<div class="item col-md-9 col-md-offset-3">
.col-md-9 .col-md-offset-3
</div>
<div class="item col-md-10 col-md-offset-2">
.col-md-10 .col-md-offset-2
</div>
<div class="item col-md-11 col-md-offset-1">
.col-md-11 .col-md-offset-1
</div>
</div>
</div>
</section>
</body>
</html>