Debian Codegraph @

pkg/shell/nav.scss

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 @use "global-variables" as *;
3
4 /* Navigation base, used for both desktop & mobile navigation */
5
6 $phone-tiny: 360px;
7 $phone: 767px;
8 $desktop: $phone + 1px;
9
10 :root {
11 --ct-color-nav-menu: var(--pf-t--global--background--color--secondary--default);
12 --ct-color-nav-highlight: var(--pf-t--global--background--color--highlight--default);
13 --ct-color-nav-highlight-text: var(--pf-t--global--text--color--on-highlight);
14 --ct-color-nav-search: #1b1b1b;
15 }
16
17 .area-ct-subnav {
18 display: flex;
19 flex-direction: column;
20 position: relative;
21
22 // Overrides for dark theme (as PF's dark theme is currently odd with nav)
23 .pf-v6-theme-dark & {
24 .pf-m-link {
25 color: var(--pf-t--global--text--color--link--default);
26 }
27 }
28
29 mark {
30 font-weight: var(--pf-t--global--font--weight--body--bold);
31 background: var(--ct-color-nav-highlight);
32 color: var(--ct-color-nav-highlight-text);
33 }
34
35 .nav-item-hint {
36 display: inline-block;
37 font-size: var(--pf-t--global--font--size--body--sm);
38 font-weight: var(--pf-t--global--font--weight--100);
39 inline-size: 100%;
40 }
41
42 // Add hover effect for clear search link
43 .non-menu-item .pf-m-link {
44 color: var(--pf-t--global--text--color--link--default);
45 }
46
47 .non-menu-item:hover .pf-m-link {
48 text-decoration: underline;
49 }
50
51 .non-menu-item {
52 display: flex;
53 justify-content: center;
54 }
55
56 .no-results {
57 padding-block: var(--pf-t--global--spacer--md);
58 padding-inline: 0;
59 }
60 }
61
62 .area-ct-content {
63 position: relative;
64 z-index: 1;
65 display: block;
66
67 > iframe {
68 block-size: 100%;
69 position: absolute;
70 }
71 }
72
73 /* Desktop navigation */
74 @media (min-width: $desktop) {
75 // Adapt PF4's new header select for 2-up
76 .ct-topnav-content .pf-v6-c-toolbar__item:not(.super-user-indicator) {
77 // Remove the margin spacing between each
78 margin-inline-end: 0;
79
80 // Collapse the 2 side border lines into 1
81 + .pf-v6-c-toolbar__item button::before {
82 margin-inline-start: -1px;
83 }
84 }
85
86 .host-apps {
87 /* FIXME: We need to change the widgets to PF6 ones; instead of CSS to fake it */
88 margin-inline-start: var(--pf-t--global--spacer--inset--page-chrome);
89 }
90
91 .mobile_v {
92 display: none !important;
93 }
94
95 .view-hosts {
96 background: transparent;
97 }
98
99 .view-hosts .sidebar-hosts {
100 animation: navHostsSlide 300ms ease-out;
101 transform-origin: top;
102 inset: 0;
103 background: var(--pf-t--global--background--color--primary--default);
104 /* Modals have 400 and modals should be in front of host switcher */
105 z-index: 399;
106 box-shadow: var(--pf-t--global--box-shadow--md);
107 block-size: fit-content;
108 padding: var(--pf-t--global--spacer--gutter--default);
109 position: relative;
110 border-radius: var(--pf-t--global--border--radius--medium);
111
112 &.edit-hosts {
113 .pf-v6-c-nav__list {
114 .pf-v6-c-button {
115 animation: navHostsEditButtonsAppear 400ms;
116 animation-timing-function: ease-in-out;
117 }
118 }
119 }
120 }
121
122 /* Move host switcher away from the host line and page edges */
123 .navbar {
124 margin: var(--pf-t--global--spacer--xs);
125 }
126
127 .header {
128 .credential-unlocked {
129 /* AAA contrast: simulate #a1a1a1 on #151515 */
130 opacity: 0.6;
131 }
132 }
133
134 .ct-switcher {
135 .pf-v6-c-select__toggle-wrapper {
136 display: flex;
137 }
138
139 > .pf-v6-c-select > button {
140 padding-inline-start: var(--pf-t--global--spacer--lg);
141 display: flex;
142 align-items: center;
143 flex-direction: row;
144 flex-wrap: nowrap;
145 justify-content: space-between;
146 inline-size: 100%;
147 }
148 }
149
150 .nav-hosts-menu {
151 grid-area: switcher;
152 position: absolute;
153 /* Inset for the top */
154 inset-block: var(--pf-t--global--spacer--3xl) auto;
155 inset-inline: var(--pf-t--global--spacer--sm) auto;
156
157 &:not(.interact) {
158 display: none;
159 }
160 }
161
162 .pf-v6-c-select__toggle-arrow {
163 font-size: 1.3rem;
164 transition-duration: 0.3s;
165 }
166
167 .clicked {
168 transform: rotate(180deg);
169 }
170
171 .ct-nav-toggle:not(.pf-v6-c-menu) {
172 border-radius: var(--pf-t--global--border--radius--small);
173 background: transparent;
174
175 &:hover {
176 background: var(--pf-t--global--background--color--action--plain--alt--hover);
177 }
178
179 &:hover, &:active, &.active, &.interact, &[aria-expanded="true"] {
180 text-decoration: none;
181
182 .hostname {
183 text-decoration: underline;
184 }
185 }
186
187 &:focus {
188 text-decoration: none;
189 }
190
191 }
192 }
193
194
195 /* Mobile navigation */
196 @media (max-width: $phone) {
197 :root {
198 --nav-icon-size: 4rem;
199 }
200
201 .desktop_v {
202 display: none !important;
203 }
204
205 .area-ct-subnav {
206 max-block-size: calc(100vh - var(--nav-icon-size));
207 align-self: flex-end;
208 z-index: 2;
209
210 &:not(.interact) {
211 display: none;
212 }
213 }
214
215 .area-ct-subnav {
216 transform-origin: bottom;
217 animation: navHostsSlide 200ms ease-out;
218 }
219
220 .header {
221 .pf-v6-c-toolbar__item {
222 margin-inline-end: 0;
223 }
224 }
225
226 .nav-system-menu {
227 inset-inline: 0;
228 block-size: auto;
229 overflow: auto;
230 max-inline-size: 29rem;
231 display: block;
232 }
233
234 .nav-hosts-menu {
235 position: absolute;
236 inset-block-end: var(--nav-icon-size);
237 inset-inline-end: var(--pf-t--global--spacer--xs);
238 max-inline-size: 100vw;
239 }
240
241 .nav-system-menu,
242 .view-hosts {
243 background: var(--pf-t--global--background--color--primary--default);
244 border-radius: var(--pf-t--global--border--radius--small);
245 box-shadow: var(--pf-t--global--box-shadow--md);
246 }
247
248 .pf-m-dark.pf-v6-c-select {
249 .pf-v6-c-select__toggle {
250 background-color: transparent;
251 }
252 }
253
254 .ct-switcher > .pf-v6-c-select {
255 .pf-v6-c-select__toggle {
256 display: block;
257 inline-size: auto;
258 }
259
260 .pf-v6-c-select__toggle-arrow {
261 transform: scale(1.5);
262 margin: unset;
263 margin-block-start: 4px;
264 transition-duration: 0.3s;
265 }
266
267 .clicked {
268 transform : rotate(180deg) scale(1.5);
269 }
270
271 > button {
272 padding-inline-start: 0;
273 }
274 }
275
276 .menu-toggle,
277 .sidebar-toggle .fa {
278 display: block;
279 transform: scale(1.5);
280 border-radius: 0 !important;
281 }
282
283 .navbar-pf {
284 .ct-switcher {
285 display: flex;
286 }
287 }
288 }
289
290 @media (max-width: $phone-tiny) {
291 // Don't have a gap for the hosts selection
292 .nav-hosts-menu {
293 inset-inline-end: 0;
294 }
295
296 // Make the hosts selection fill the width of the page
297 .view-hosts .sidebar-hosts .pf-v6-c-page__sidebar-body {
298 inline-size: 100vw;
299 }
300 }
301
302 .navbar.navbar-pf-vertical {
303 border-block-start: 0;
304 }
305
306 .ct-switcher {
307 block-size: 100%;
308
309 > .pf-v6-c-select {
310 block-size: 100%;
311 padding: 0;
312
313 .pf-v6-c-select__toggle-text {
314 text-align: start;
315 }
316 }
317
318 .username {
319 display: inline-block;
320 }
321
322 .at {
323 opacity: 0.8;
324 }
325
326 .hostname {
327 display: block;
328 font-weight: var(--pf-t--global--font--weight--heading--default);
329 overflow: hidden;
330 text-overflow: ellipsis;
331 }
332 }
333
334 .ct-switcher-localonly {
335 padding-inline-start: var(--pf-t--global--spacer--lg);
336 padding-block-start: var(--pf-t--global--spacer--sm);
337 }
338
339 .pf-v6-c-select__toggle {
340 block-size: 100%;
341 }
342
343 .nav-action {
344 border-radius: var(--pf-t--global--border--radius--small);
345 padding-inline: var(--pf-t--global--spacer--control--horizontal--default);
346 align-items: center;
347 }
348
349 .host-apps {
350 flex: 1 1 0;
351 position: relative;
352 // HACK: 2 rem is a magic value as nav-icon-size is not sufficient
353 // Unclear yet where this height difference comes from
354 max-block-size: calc(100vh - 2rem - var(--nav-icon-size));
355 // In mobile, make the search at the top and the rest scroll
356 @media (max-width: $phone) {
357 display: grid;
358 grid-template-rows: auto 1fr;
359 position: sticky;
360 inset-block-start: 0;
361 margin-block: var(--pf-t--global--spacer--gutter--default);
362
363 > .search {
364 margin-inline: var(--pf-t--global--spacer--gutter--default);
365 inline-size: initial;
366 }
367
368 > .pf-v6-c-nav {
369 padding-inline: var(--pf-t--global--spacer--gutter--default);
370 overflow-y: auto;
371 }
372 }
373 }
374
375 .nav-system-menu {
376 overflow-x: hidden;
377 overflow-y: auto;
378
379 // Flow items, if wider (useful for mobile). Use 1fr (not auto) so every
380 // group's column tracks are equal-width; otherwise each group's grid sizes
381 // its columns to its own content and the second column fails to align
382 // between groups (e.g. System vs Tools).
383 .pf-v6-c-nav__list {
384 display: grid;
385 grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
386 }
387
388 // Give additional style to individual menu items
389 .pf-v6-c-nav__link {
390 display: grid;
391 grid-template: "name status" "match match";
392 grid-template-columns: 1fr auto;
393 justify-content: space-between;
394 gap: 0 var(--pf-t--global--spacer--md);
395 padding-inline-end: var(--pf-t--global--spacer--md);
396 // In mobile, sometimes items wrap; neighbors should also fill the space
397 block-size: 100%;
398
399 > .nav-item-name {
400 grid-area: name;
401 }
402
403 > .nav-item-status {
404 grid-area: status;
405 }
406
407 > .nav-item-hint {
408 grid-area: match;
409 }
410
411 > :empty {
412 display: none;
413 }
414
415 // Add a background to shine through the icon's gaps
416 // (for better contrast, even when hovering / selected)
417 .nav-item-status {
418 position: relative;
419
420 > svg {
421 // Set position for the icon sandwiching
422 position: relative;
423 // Move the icon up the stack
424 z-index: 1;
425 }
426 }
427 }
428 }
429
430 .view-hosts .sidebar-hosts {
431 .pf-v6-c-nav__list {
432 overflow-y: auto;
433 }
434
435 .pf-v6-c-page__sidebar-body {
436 display: grid;
437 grid-template-rows: max-content max-content max-content;
438
439 @media (min-width: $desktop) {
440 max-block-size: 100%;
441 }
442
443 }
444
445 .pf-v6-c-nav {
446 overflow: auto;
447 // Don't run off the page when displaying many entries
448 // HACK: Unclear where the spacing comes from
449 max-block-size: calc(100vh - var(--pf-t--global--spacer--3xl) * 3);
450 }
451
452 .nav-hosts-actions {
453 display: grid;
454 gap: var(--pf-t--global--spacer--sm);
455 margin-block-start: var(--pf-t--global--spacer--md);
456 }
457
458 .nav-item {
459 display: grid;
460 grid-template-columns: 1fr auto;
461 border-radius: var(--pf-t--global--border--radius--small);
462
463 &:has(:hover, .pf-m-current) {
464 background-color: var(--pf-t--global--background--color--action--plain--hover);
465 }
466
467 &:has(.pf-m-current) {
468 /* Add a selected color */
469 border-inline-start: var(--pf-t--global--border--width--extra-strong) solid var(--ct-color-host-accent);
470 }
471
472 > .pf-v6-c-nav__link {
473 flex-direction: column;
474 justify-content: center;
475 background-color: transparent;
476 }
477 }
478
479 .nav-item-actions {
480 display: flex;
481 gap: var(--pf-t--global--spacer--xs);
482 padding-inline: var(--pf-t--global--spacer--sm);
483 align-self: center;
484 }
485 }
486
487 .nav-item-actions:empty {
488 /* Nav item actions are part of the grid, whether they have content or not. If they do not have content, don't add extra spacing. */
489 display: none;
490 }
491
492 .ct-topnav-content {
493 margin-inline-start: auto;
494 }
495
496 // Rework navigation toggles in desktop and (especially) mobile modes
497 .super-user-indicator > button,
498 .ct-nav-toggle:not(.pf-v6-c-menu) {
499 // The normal margin to the right of the select dropdown makes them look uncentered in the masthead.
500 // https://github.com/patternfly/patternfly/issues/6632
501 .pf-v6-c-menu-toggle__toggle-icon {
502 margin-inline-end: 0;
503 }
504
505 // The way the event is handled, it checks for the button, but not the icon. It should bubble, but doesn't. We can work around this by passing mouse events through.
506 svg {
507 pointer-events: none;
508 }
509 }
510
511 // In mobile view keep the non PF4 of displaying hover / focus state in the masthead / toolbar items
512 // This can go away once we move the host selector inside the Masthead
513 // https://github.com/patternfly/patternfly/issues/4524
514 @media (max-width: $phone) {
515 .ct-nav-toggle {
516 &:hover, &:active, &.active, &.interact, &[aria-expanded="true"], &.pf-m-expanded {
517 text-decoration: none;
518
519 .hostname {
520 text-decoration: underline;
521 }
522 }
523
524 &:focus {
525 text-decoration: none;
526 }
527 }
528
529 // Hide border from navigation items for mobile
530 .pf-v6-c-menu-toggle::before {
531 border: none;
532 }
533
534 // Hide local-only host switcher (i.e. when only showing the current user name)
535 .ct-switcher-localonly {
536 display: none !important;
537 }
538 }
539
540 .ct-locked .ct-lock-wrapper > svg {
541 margin-inline-end: var(--pf-t--global--spacer--sm);
542 color: var(--pf-t--global--icon--color--severity--moderate--default);
543 }
544
545 .super-user-indicator {
546 @media (min-width: $desktop) {
547 > .ct-locked {
548 .ct-lock-wrapper {
549 background: var(--pf-t--global--background--color--secondary--default);
550 border-radius: var(--pf-v6-c-button--BorderRadius);
551 padding-block: var(--pf-t--global--spacer--xs);
552 padding-inline: var(--pf-t--global--spacer--sm);
553
554 > svg {
555 color: var(--pf-t--global--icon--color--severity--moderate--default);
556 }
557 }
558
559 &:hover, &:focus {
560 background: none;
561
562 .ct-lock-wrapper {
563 background: var(--pf-t--global--background--color--secondary--hover);
564 }
565 }
566 }
567 }
568
569 > .ct-unlocked {
570 &:hover, &:focus {
571 text-decoration: underline;
572 }
573
574 svg {
575 display: none;
576 }
577 }
578 }
579
580 // Mobile sizes
581 @media (max-width: $phone) {
582 /* Mobile uses a light background, so use the darker variants for selected and hover */
583 .pf-v6-c-nav__link {
584 --pf-v6-c-nav__link--m-current--BackgroundColor: var(--pf-t--global--background--color--action--plain--clicked);
585 --pf-v6-c-nav__link--hover--BackgroundColor: var(--pf-t--global--background--color--action--plain--hover);
586 }
587
588 #host-toggle,
589 button.ct-nav-toggle,
590 #nav-system-item > .pf-v6-c-button__text {
591 // Remove gap between text and icon
592 --pf-v6-c-button--Gap: 0;
593 --pf-v6-c-menu-toggle--Gap: 0;
594 // Stretch to navbar
595 block-size: 100%;
596 // Don't stretch to fill content; make optimal width same as height
597 inline-size: var(--pf-t--global--spacer--4xl);
598 // Leave enough space for 5 items (4 + spinner)
599 max-inline-size: calc(100vw / 5);
600 display: grid !important;
601 grid-template-rows: 28px 1fr;
602 justify-content: center;
603 justify-items: center;
604 padding-inline: var(--pf-t--global--spacer--xs);
605 align-items: center;
606
607 // Remove the toggled outline
608 .pf-v6-c-menu-toggle::before {
609 display: none !important;
610 }
611
612 // Don't show toggle icon
613 .pf-v6-c-menu-toggle__icon {
614 margin-inline-end: 0;
615 }
616
617 .pf-v6-c-menu-toggle__image {
618 align-self: center;
619 margin: 0 !important;
620 }
621
622 // #host-sel specific
623 .pf-v6-c-select__toggle-arrow {
624 // This is here because Chrome is weird sometimes...
625 padding-block: 2px 5px;
626 padding-inline: 0;
627 }
628
629 > .pf-v6-c-select__toggle-wrapper {
630 flex: none;
631 max-inline-size: 100%;
632 }
633 }
634
635 // FIXME @Venefilyn: Some bug is causing the listener in SidebarToggle to trigger pointer clicks on internal elements causing the menu to not work.
636 // Setting it to initial means that the after content that covers up the whole button will still allow us to trigger it correctly.
637 #nav-system-item::after {
638 pointer-events: initial
639 }
640
641 // PF6 introduced toolbar column gap which is great in general. But not what we want for mobile view
642 .ct-topnav-content {
643 --pf-v6-c-toolbar__content-section--ColumnGap: 0;
644 }
645 }
646
647 /* Navigation animation */
648
649 @keyframes navHostsSlide {
650 0% { opacity: 0.25; transform: scaleY(0); }
651 25% { opacity: 0.5; transform: scaleY(0.25); }
652 100% { opacity: 1; transform: scaleY(1); }
653 }
654
655 @keyframes navHostsEditButtonsAppear {
656 0% { opacity: 0; max-block-size: 0; max-inline-size: 0; }
657 50% { opacity: 0; max-block-size: 0; max-inline-size: 0; }
658 75% { opacity: 0; max-block-size: 100%; max-inline-size: 100%; }
659 100% { opacity: 1; max-block-size: 100%; max-inline-size: 100%; }
660 }