header-navigation.pcss.css

Same filename in other branches
  1. 10 core/themes/olivero/css/components/header-navigation.pcss.css
  2. 11.x core/themes/olivero/css/components/header-navigation.pcss.css

Navigation in header.

File

core/themes/olivero/css/components/header-navigation.pcss.css

View source
  1. /**
  2. * @file
  3. * Navigation in header.
  4. */
  5. @import "../base/variables.pcss.css";
  6. .header-nav {
  7. position: fixed;
  8. z-index: 501; /* Appear above overlay and contextual links in header. */
  9. inset-block-start: 0;
  10. inset-inline-start: 100%;
  11. visibility: hidden;
  12. overflow: auto;
  13. /**
  14. * Ensure that header nav not use additional space and force system branding
  15. * block text to unnecessarily wrap.
  16. */
  17. flex-basis: 0;
  18. flex-grow: 1; /* Necessary for IE11. */
  19. width: 100%;
  20. max-width: var(--mobile-nav-width);
  21. height: 100%;
  22. padding-block: 0 var(--sp);
  23. padding-inline-start: var(--sp);
  24. padding-inline-end: var(--sp);
  25. /**
  26. * Create room for the "close" button. We cannot use margin because The
  27. * mobile navigation needs to slide beneath the button, but we also cannot
  28. * use padding because that would enable the button to scroll out of the
  29. * viewport on short screens.
  30. */
  31. border-block-start: solid var(--color--white) var(--sp3);
  32. background-color: var(--color--white);
  33. box-shadow: 0 0 72px rgba(0, 0, 0, 0.1);
  34. &.is-active {
  35. visibility: visible;
  36. transform: translateX(-100%); /* LTR */
  37. }
  38. @supports (flex-basis: max-content) {
  39. flex-basis: max-content;
  40. }
  41. @media (--sm) {
  42. border-top-width: var(--sp5);
  43. }
  44. @media (--md) {
  45. padding-block-end: var(--sp3);
  46. padding-inline-start: var(--sp3);
  47. border-top-width: var(--sp7);
  48. }
  49. @media (--lg) {
  50. grid-column: 5 / 14;
  51. }
  52. /*
  53. * Ensure top border has the same color as the background when in forced colors.
  54. */
  55. @media (forced-colors: active) {
  56. border-top-color: canvas;
  57. }
  58. }
  59. /*
  60. * Only apply transition styles when JS is loaded. This
  61. * works around https://bugs.chromium.org/p/chromium/issues/detail?id=332189
  62. */
  63. html.js .header-nav {
  64. transition: visibility 0.2s, transform 0.2s;
  65. }
  66. /* Toolbar is fixed, and tray is vertical. */
  67. body.toolbar-vertical .header-nav {
  68. border-top-width: calc(var(--toolbar-height) + var(--sp3));
  69. @media (--sm) {
  70. border-top-width: calc(var(--toolbar-height) + var(--sp5));
  71. }
  72. }
  73. /* Toolbar is fixed, and tray is vertical or toolbar is horizontal and tray is closed. */
  74. body.toolbar-vertical .header-nav,
  75. body.toolbar-horizontal.toolbar-fixed .header-nav {
  76. @media (--md) {
  77. border-top-width: calc(var(--toolbar-height) + var(--sp7));
  78. }
  79. }
  80. /* Toolbar is horizontal fixed, and tray is open. */
  81. body.toolbar-horizontal.toolbar-fixed.toolbar-tray-open .header-nav {
  82. @media (--md) {
  83. border-top-width: calc(var(--toolbar-height) + var(--toolbar-tray-height) + var(--sp7));
  84. }
  85. }
  86. body:not(.is-always-mobile-nav) .header-nav {
  87. @media (--nav) {
  88. position: static;
  89. display: flex;
  90. visibility: visible;
  91. overflow: visible;
  92. grid-column: 5 / 15;
  93. align-items: center;
  94. justify-content: flex-end;
  95. max-width: none;
  96. height: var(--header-height-wide-when-fixed);
  97. margin-block-start: auto;
  98. padding-block: 0;
  99. padding-inline-start: 0;
  100. padding-inline-end: 0;
  101. transition: transform 0.2s;
  102. transform: none;
  103. border-block-start: 0;
  104. box-shadow: none;
  105. }
  106. }
  107. body.is-always-mobile-nav {
  108. /* Toolbar is fixed, and tray is vertical or toolbar is horizontal and tray is closed. */
  109. &.toolbar-vertical .header-nav,
  110. &.toolbar-horizontal.toolbar-fixed .header-nav {
  111. @media (--nav) {
  112. border-top-width: calc(var(--toolbar-height) + var(--sp11));
  113. }
  114. }
  115. /* Toolbar is horizontal fixed, and tray is open. */
  116. &.toolbar-horizontal.toolbar-fixed.toolbar-tray-open .header-nav {
  117. @media (--nav) {
  118. border-top-width: calc(var(--toolbar-height) + var(--toolbar-tray-height) + var(--sp11));
  119. }
  120. }
  121. & .header-nav {
  122. @media (--nav) {
  123. overflow: auto;
  124. max-width: calc((7 * (var(--grid-col-width--nav) + var(--grid-gap--nav))));
  125. padding-inline-end: var(--sp);
  126. transition: transform 0.2s, visibility 0.2s;
  127. border-top-width: var(--sp11);
  128. }
  129. @media (--grid-max) {
  130. max-width: calc(100vw - (var(--max-width) + var(--content-left)) + ((7 * (var(--grid-col-width--max) + var(--grid-gap--max)))));
  131. padding-inline-end: calc(100vw - (var(--max-width) + var(--content-left) - var(--sp)));
  132. }
  133. }
  134. }
  135. [dir="rtl"] .header-nav.is-active {
  136. transform: translateX(100%);
  137. }
  138. .header-nav-overlay {
  139. position: fixed;
  140. z-index: 101;
  141. inset-block-start: 0;
  142. inset-inline-start: 0;
  143. display: none;
  144. width: 100%;
  145. height: 100vh;
  146. opacity: 0.2;
  147. background: var(--color--blue-20);
  148. @media (forced-colors: active) {
  149. background: canvastext;
  150. }
  151. @nest .is-overlay-active
  152. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.