/
switcher.less
680 lines (567 loc) · 16.4 KB
/
switcher.less
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
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
@mobile-button-size: 56px;
/* Navigation base, used for both desktop & mobile navigation */
.nav-sidebar .dashboard-link:not(.active) a:hover {
background: rgba(57, 63, 68, 0.5) !important;
}
.nav-item-pf-header {
color: #fff;
font-size: 16px;
margin: 18px 20px 10px 20px;
}
.area-ct-subnav {
background: #393f44;
border-right: 1px solid #292e34;
-webkit-flex: none;
flex: none;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
position: relative;
z-index: 2;
opacity: 1;
.list-group {
border: none;
margin: 10px 0;
}
.list-group-item {
padding: 0;
background: inherit;
border: none;
z-index: 1;
&, > a {
transition: all 300ms;
}
&:hover, &:hover > a {
transition: all 150ms; // Speed up animation on hover
}
&:hover,
&.active {
/* Move hover & selected above overflow fade */
z-index: 3;
a {
color: #fff;
}
}
&:hover {
background: rgba(77, 82, 88, 0.5);
}
&.active {
background: #4d5258;
a {
font-weight: 600;
}
}
a {
padding: 10px 15px;
display: block;
color: #d1d1d1;
text-decoration: none;
transition: all 300ms
}
}
/* Fade start and end of the host menu to indicate more content is available */
.dropdown-toggle {
position: relative;
overflow: visible !important;
}
.dropdown-toggle:after,
&:after {
content: '';
display: block;
position: absolute;
left: 0;
right: 0;
height: 2rem;
pointer-events: none;
z-index: 2;
/* Accomodate scrollbars with margin (IE11 needs 18px; rest are less) */
margin-right: 18px;
}
.dropdown-toggle:after {
background: linear-gradient(to bottom, #393f44, rgba(57, 63, 68, 0));
margin-top: 1px;
bottom: -2rem; // Move down by the same size as the height
}
&:after {
background: linear-gradient(to top, #393f44, rgba(57, 63, 68, 0));
bottom: 0;
height: 4rem;
}
}
.nav-sidebar > .list-group {
.dashboard-link {
display: block;
&:not(.active) .fa {
color: #72767b !important;
}
}
}
.machine-dropdown {
position: relative;
-webkit-flex: none;
flex: none;
.dropdown-toggle span {
font-size: 14px;
}
&:after {
content: "";
position: absolute;
margin: 0 10px; // Jut out 5 pixels (15 - 5) on the sides
left: 0;
right: 0;
bottom: 0;
height: 1px;
background: #4d5258;
}
}
.machine-dropdown > .dropdown-toggle span,
.host-apps a {
overflow: hidden;
text-overflow: ellipsis;
}
.host-apps {
-webkit-flex: 1 1 0;
flex: 1 1 0;
overflow-x: hidden;
overflow-y: auto;
position: relative;
}
.area-ct-content {
> iframe {
height: 100%;
}
> .curtains-ct {
position: static !important;
}
}
/* Desktop navigation */
@media screen and (min-width: 768px) {
.area-ct-navbar {
-webkit-flex: none;
flex: none;
min-width: 100%;
}
.area-ct-content {
-webkit-flex: auto;
flex: auto;
position: relative;
/* Position as absolute to make things work on old Chrome versions,
mainly to make tests pass */
> iframe {
position: absolute;
}
> .curtains-ct {
position: absolute !important;
}
> iframe,
> .curtains-ct {
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.area-ct-body {
position: relative;
-webkit-flex: auto;
flex: auto;
z-index: 3;
display: -webkit-flex;
display: flex;
/* IE11 needs to have the flex-basis set to page max,
else it stretches too tall */
-webkit-flex-basis: 100%;
flex-basis: 100%;
}
.nav-pf-vertical {
position: static !important;
height: 100%;
border-right-width: 0;
top: 0;
}
.nav-sidebar-wrap {
-webkit-flex: none;
flex: none;
z-index: 3;
&:not(.expanded) {
width: unit(@sidebar-width-sm, px);
.nav-sidebar {
width: unit(@sidebar-width-sm, px);
}
.list-group-item-value {
opacity: 0;
transition: opacity 150ms ease-out;
}
}
}
.nav-sidebar {
/* Use absolute position to make old Chrome (2015 Dec) tests pass */
position: absolute !important;
height: 100%;
transition: all 150ms ease-out;
box-shadow: 0 0;
background: linear-gradient(to left, #030303, #292e34 1px);
span.first-letter {
font-size: 0px !important;
color: #d1d1d1;
&:first-letter {
font-size: 22px !important;
}
}
.fa {
margin-left: -4px;
margin-top: -1px;
&:not(.first-letter) {
font-size: 22px !important;
}
}
.list-group-item {
border-right-width: 0;
overflow: hidden;
> a {
// Patternfly now sets & unsets padding-right;
// ...so we'll set it once again
padding-right: 20px;
}
&:focus {
background: active;
}
}
}
.nav-sidebar-wrap:not(.expanded) .nav-sidebar:not(.clicked):hover {
width: unit(@sidebar-width-full, px);
box-shadow: 0 0 3px rgba(0,0,0,0.5), 0 0 32px rgba(0,0,0,0.75);
transition-duration: 500ms;
transition-timing-function: cubic-bezier(0,1.2,0.8,1);
.list-group-item-value {
transition-duration: 300ms;
opacity: 1;
}
.first-letter {
opacity: 0;
}
}
.single-nav {
.nav-sidebar {
display: none;
}
.nav-sidebar-wrap {
width: 0px;
}
.area-ct-subnav {
left: 0px;
}
}
.area-ct-layout {
display: -webkit-flex;
display: flex;
width: 100%;
height: 100%;
-webkit-flex-flow: column;
flex-flow: column;
align-content: stretch;
}
.area-ct-subnav {
visibility: visible !important;
top: 0;
left: 0;
bottom: 0;
width: 15em;
}
}
/* Mobile navigation */
@media screen and (max-width: 767px) {
/* Use native mobile fonts (when available) for nav & menu text */
.area-ct-navbar, .area-ct-body {
font-family: roboto, san francisco, helvetica light, noto, helvetica, sans-serif;
font-size: 14px;
align-content: stretch;
align-items: stretch;
a {
font-size: 14px !important;
padding: 12px 15px;
}
}
/* Layout UI in CSS grids
(all mobile browsers support this new layout type)
How this works:
CSS grids version 1 is now implemented in all mobile browsers; we can use it.
However, display: container and subgrids are not implemented in Chrome yet.
To work around this, we do a little more complex gridding by overlapping
child grids on top of the parent grid. We basically set up the main grid
as with a gutter of @mobile-button-size ("56px") on the top, right side,
and bottom. We then stretch the child grids to this.
The elements are then assigned grid names with 'grid-area' and placed in the
grid using 'grid-template-areas', based on their immediate parent (which is
set as a grid display type).
Some grid-areas override their template placement with grid-columns and
grid-rows. The most notible being the navmenu, so that it can overlap
content. The value for grid-colums is either a single number or first/last+1
(which basically means go from first and stop when it hits the grid
column/row _after_ the one you want to last fill).
Note: Due to less, we have to wrap some of the values in ~"" so that they
will be passed directly to the resulting CSS... else less will want to try
to do math, which isn't want we want.
Tip: Firefox dev tools let you visualize grids in the "layout" subtab of the
"inspector" tab.
*/
.area-ct-layout, .area-ct-body, .area-ct-navbar {
display: grid;
grid-template-columns: auto @mobile-button-size;
grid-template-rows: @mobile-button-size 1fr @mobile-button-size;
align-content: end;
}
.area-ct-layout {
grid-template-areas:
"content content"
"content content"
"nav topbar";
height: 100%;
width: 100%;
}
.area-ct-body {
/* Stretch the nav wrapper to the same area on the parent grid */
grid-column: ~"1/3";
grid-row: ~"1/4";
// As Chrome on Mobile is wonky,
// here's an alternate way to set the size that works everywhere
grid-template-rows: ~"@{mobile-button-size} calc(100% - @{mobile-button-size} * 2) @{mobile-button-size}";
z-index: 2;
/* Pass through mouse events */
pointer-events: none;
grid-template-areas:
"content content"
"content content"
"nav empty";
> * {
/* Allow mouse events for children */
pointer-events: auto;
}
}
.area-ct-navbar {
/* Create another child grid and stretch it to the parent grid */
pointer-events: none;
display: grid;
background: transparent;
border: none;
grid-template:
"notmenu menu menu"
"notheader notheader header";
grid-area: topbar;
grid-column: ~"1/3"; /* Expand to the whole column */
grid-row: ~"2/4";
grid-template-rows: auto @mobile-button-size;
grid-template-columns: minmax(@mobile-button-size, auto) auto @mobile-button-size;
z-index: 3;
> * {
pointer-events: auto;
}
&:before,
&:after {
display: none;
}
}
.navbar-header {
grid-area: header;
background: #292e34;
}
.navbar-collapse {
grid-area: menu;
align-self: end;
background: #292e34;
}
.navbar-brand {
display: none;
}
.navbar-toggle {
float: right !important;
margin: 0 !important;
width: 100%;
height: 100%;
}
.area-ct-content {
display: block;
grid-area: content;
z-index: 1;
> iframe {
animation: navFadeIn 300ms;
}
}
.nav-sidebar-wrap {
grid-area: nav;
z-index: 3;
max-width: ~"calc(100vw - @{mobile-button-size})";
overflow: auto;
overflow-y: hidden;
position: relative;
}
.nav-sidebar {
position: static !important;
width: auto;
max-width: 100%;
overflow: hidden;
overflow-x: auto;
background: linear-gradient(to bottom, #030303, #292e34 1px);
ul, li {
padding: 0;
margin: 0;
}
> .list-group {
position: relative;
display: -webkit-flex;
display: flex;
li {
-webkit-flex: auto;
flex: auto;
}
}
.list-group-item {
width: auto !important;
height: 100% !important;
margin: 0 !important;
padding: 0 !important;
position: static;
max-width: 33vw;
a {
display: inline-block !important;
padding: 6px 12px !important;
padding: 0;
text-align: center;
width: auto !important;
min-width: 80px;
width: 100% !important;
height: @mobile-button-size !important;
margin-bottom: 12px; // Hack to hide the scrollbar
}
&.active {
z-index: 2;
a {
background: #393f44 !important;
&:before {
bottom: 0 !important;
left: 0 !important;
right: 0 !important;
top: auto !important;
height: 3px !important;
width: auto !important;
z-index: 3;
}
&:after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border: 1px solid black;
border-width: 0 1px;
pointer-events: none;
opacity: 0.5;
z-index: 4;
}
}
&:first-child a:after {
border-left: none;
}
}
}
.fa,
.pficon-container-node,
.list-group-item-value {
display: inline-block;
line-height: 1 !important;
font-weight: 400;
}
.fa,
.pficon-container-node {
margin: 0 auto !important;
float: none !important;
font-size: 24px !important;
}
.list-group-item-value {
font-size: 12px !important; // Set to small native mobile font size
line-height: 2 !important; // Breathing room for ascenders/descenders
margin: -6px auto 0; // Half font size, to offset double line-height
padding: 0 !important; // Override Patternfly
}
}
/* Restrict width of hostname nav label in mobile */
#host-nav-item .list-group-item-value {
max-width: ~"calc(20vw - 24px)";
}
.area-ct-subnav {
display: -webkit-flex !important;
display: flex !important;
align-self: end;
grid-area: navmenu;
max-height: 100%;
min-height: 50%;
grid-column: 1;
grid-row: 2;
z-index: 2;
position: relative;
overflow: hidden;
opacity: 0;
transform: translate(0,100%) scaleY(0);
transition: opacity 200ms ease-in 100ms, transform 100ms ease-in 300ms;
&.interact {
transform: none;
opacity: 1;
overflow: visible;
transition: bottom 300ms ease-out, box-shadow 300ms ease-out, transform 300ms ease-out;
}
.dropdown-menu {
width: auto !important;
left: @mobile-button-size / 2 !important;
right: @mobile-button-size / -2 !important;
animation: navFadeInSlideDown 600ms;
}
}
.host-apps {
-webkit-flex: auto;
flex: auto;
max-height: 100%;
}
.navbar-collapse > ul,
.area-ct-subnav {
box-shadow: 0 0 9px ~"rgba(0, 0, 0, 0.4)" !important;
}
/* Add an indicator for the host menu in mobile nav */
.has-menu {
.pficon-container-node {
position: relative;
&:after {
font-family: FontAwesome;
content: "\f106";
position: absolute;
font-size: 1.75rem;
position: absolute;
bottom: 0.25rem;
right: -1.5rem;
color: #fff;
opacity: 0.5;
transition: all 300ms;
}
}
&.menu-visible .pficon-container-node {
&:after {
transform: scale(1, -1);
bottom: 0.25ex;
opacity: 0.75;
}
}
&:not(.active) .pficon-container-node:after {
opacity: 0;
}
}
}
/* Navigation animation */
@keyframes navFadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes navFadeInSlideDown {
from { opacity: 0; max-height: 0; }
to { opacity: 1; max-height: auto; }
}