_main-nav.scss 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. @use 'sass:map';
  2. .nav-wrapper {
  3. position: relative;
  4. margin-left: -$menu-width;
  5. width: $menu-width;
  6. float: left;
  7. display: flex;
  8. flex-direction: column;
  9. height: 100%;
  10. background: $nav-grey-1;
  11. .inner {
  12. background: $nav-grey-1;
  13. border-right: 1px solid transparent; // ensure visible separation in Windows High Contrast mode
  14. @include media-breakpoint-up(sm) {
  15. // On medium, make it possible for the nav links to scroll.
  16. display: flex;
  17. flex-flow: column nowrap;
  18. }
  19. }
  20. }
  21. .nav-toggle.icon {
  22. position: absolute;
  23. padding-left: $mobile-nice-padding;
  24. cursor: pointer;
  25. border: 1px solid transparent; // ensure visible separation in Windows High Contrast mode
  26. background-color: transparent;
  27. &:before {
  28. position: relative;
  29. top: 3px;
  30. font-size: 40px;
  31. color: $color-white;
  32. line-height: 40px;
  33. content: '\2261';
  34. }
  35. }
  36. .nav-main {
  37. ul,
  38. li {
  39. margin: 0;
  40. padding: 0;
  41. list-style-type: none;
  42. }
  43. li {
  44. @include transition(border-color 0.2s ease);
  45. position: relative;
  46. }
  47. a {
  48. @include transition(border-color 0.2s ease);
  49. -webkit-font-smoothing: auto;
  50. text-decoration: none;
  51. display: block;
  52. color: $color-menu-text;
  53. padding: 0.8em 1.7em;
  54. font-size: 1em;
  55. font-weight: normal;
  56. // Note, font-weights lower than normal,
  57. // and font-size smaller than 1em (80% ~= 12.8px),
  58. // makes the strokes thinner than 1px on non-retina screens
  59. // making the text semi-transparent
  60. &:hover,
  61. &:focus {
  62. background-color: $nav-item-hover-bg;
  63. color: $color-white;
  64. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  65. }
  66. }
  67. .menu-item a {
  68. position: relative;
  69. white-space: nowrap;
  70. border-left: 3px solid transparent;
  71. &:before {
  72. font-size: 1rem;
  73. vertical-align: -15%;
  74. margin-right: 0.5em;
  75. }
  76. // only really used for spinners and settings menu
  77. &:after {
  78. font-size: 1.5em;
  79. margin: 0;
  80. position: absolute;
  81. right: 0.5em;
  82. top: 0.5em;
  83. margin-top: 0;
  84. }
  85. }
  86. .menu-active {
  87. background: $nav-item-active-bg;
  88. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  89. > a {
  90. border-left-color: $color-salmon;
  91. color: $color-white;
  92. }
  93. }
  94. .nav-footer-submenu {
  95. a {
  96. border-left: 3px solid transparent;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. white-space: nowrap;
  100. &:before {
  101. font-size: 1rem;
  102. margin-right: 0.5em;
  103. vertical-align: -10%;
  104. }
  105. }
  106. }
  107. .account {
  108. display: none;
  109. }
  110. *:focus {
  111. @include show-focus-outline-inside;
  112. }
  113. }
  114. .icon--menuitem {
  115. width: 1.25em;
  116. height: 1.25em;
  117. margin-right: 0.5em;
  118. vertical-align: text-top;
  119. }
  120. .icon--submenu-trigger {
  121. // The menus are collapsible on desktop only.
  122. display: none;
  123. @include media-breakpoint-up(sm) {
  124. display: block;
  125. width: 1.5em;
  126. height: 1.5em;
  127. position: absolute;
  128. top: 0.8125em;
  129. right: 0.5em;
  130. @include transition(transform 0.3s ease);
  131. .menu-item.submenu-active & {
  132. transform-origin: 50% 50%;
  133. transform: rotate(180deg);
  134. }
  135. }
  136. }
  137. .icon--submenu-header {
  138. display: block;
  139. width: 4rem;
  140. height: 4rem;
  141. margin: 0 auto 0.8em;
  142. opacity: 0.15;
  143. }
  144. .nav-submenu {
  145. background: $nav-submenu-bg;
  146. h2 {
  147. display: none;
  148. }
  149. .menu-item a {
  150. white-space: normal;
  151. padding: 0.9em 1.7em 0.9em 4.5em;
  152. &:before {
  153. margin-left: -1.5em;
  154. }
  155. .icon--menuitem {
  156. margin-left: -1.75em;
  157. }
  158. &:hover {
  159. background-color: rgba(100, 100, 100, 0.2);
  160. }
  161. }
  162. li {
  163. border: 0;
  164. }
  165. &__footer {
  166. margin: 0;
  167. padding: 0.9em 1.7em;
  168. text-align: center;
  169. color: $color-menu-text;
  170. }
  171. }
  172. .nav-search {
  173. position: relative;
  174. padding: 0 1em 1em;
  175. margin: 0;
  176. width: 100%;
  177. box-sizing: border-box;
  178. label {
  179. @include visuallyhidden();
  180. }
  181. input,
  182. button {
  183. border-radius: 0;
  184. font-size: 1em;
  185. border: 0;
  186. }
  187. input {
  188. cursor: pointer;
  189. border: 1px solid $nav-search-border;
  190. background-color: $nav-search-bg;
  191. color: $nav-search-color;
  192. padding: 0.8em 2.5em 0.8em 1em;
  193. font-weight: 600;
  194. &:hover {
  195. background-color: $nav-search-hover-bg;
  196. }
  197. &:active,
  198. &:focus {
  199. background-color: $nav-search-focus-bg;
  200. color: $nav-search-focus-color;
  201. }
  202. &::placeholder {
  203. color: $color-menu-text;
  204. }
  205. }
  206. button {
  207. background-color: transparent;
  208. position: absolute;
  209. top: 0;
  210. right: 1em;
  211. bottom: 0;
  212. padding: 0;
  213. width: 3em;
  214. &:hover {
  215. background-color: $nav-item-hover-bg;
  216. }
  217. &:active {
  218. background-color: $nav-item-active-bg;
  219. }
  220. &:before {
  221. font-family: $font-wagtail-icons;
  222. font-weight: 200;
  223. text-transform: none;
  224. content: map.get($icons, 'search');
  225. display: block;
  226. height: 100%;
  227. line-height: 3.3em;
  228. padding: 0 1em;
  229. }
  230. }
  231. }
  232. // Navigation open condition
  233. body.nav-open {
  234. .wrapper {
  235. transform: translate3d($menu-width, 0, 0);
  236. }
  237. .content-wrapper {
  238. position: fixed;
  239. }
  240. footer {
  241. bottom: 1px;
  242. }
  243. }
  244. // Explorer open condition, widens navigation area
  245. body.explorer-open {
  246. .wrapper {
  247. transform: translate3d($menu-width-max, 0, 0);
  248. }
  249. .nav-wrapper {
  250. margin-left: -$menu-width-max;
  251. width: $menu-width-max;
  252. }
  253. .nav-main {
  254. display: none;
  255. }
  256. }
  257. @include media-breakpoint-up(sm) {
  258. .wrapper,
  259. body.nav-open .wrapper {
  260. transform: none;
  261. padding-left: $menu-width;
  262. @include transition(padding-left $menu-transition-duration ease);
  263. }
  264. body.sidebar-collapsed .wrapper {
  265. padding-left: $menu-width-slim;
  266. }
  267. .nav-wrapper {
  268. // height and position necessary to force it to 100% height of screen (with some JS help)
  269. position: absolute;
  270. left: 0;
  271. height: 100%;
  272. margin-left: 0;
  273. .inner {
  274. height: 100%;
  275. position: fixed;
  276. width: $menu-width;
  277. z-index: $nav-wrapper-inner-z-index;
  278. }
  279. }
  280. .nav-toggle.unbutton {
  281. display: none;
  282. }
  283. .nav-main {
  284. overflow: auto;
  285. margin-bottom: $nav-footer-closed-height;
  286. @include transition(margin-bottom 0.2s ease);
  287. .nav-footer {
  288. position: fixed;
  289. width: $menu-width;
  290. bottom: 0;
  291. background-color: $nav-footer-submenu-bg;
  292. }
  293. .nav-footer-submenu {
  294. @include transition(max-height 0.2s ease);
  295. max-height: 0;
  296. }
  297. &--open-footer {
  298. margin-bottom: $nav-footer-open-height;
  299. .nav-footer-submenu {
  300. max-height: $nav-footer-submenu-height;
  301. }
  302. }
  303. .account {
  304. @include clearfix;
  305. background: $nav-footer-account-bg;
  306. color: $color-menu-text;
  307. text-transform: uppercase;
  308. display: block;
  309. cursor: pointer;
  310. &:hover {
  311. background-color: rgba(100, 100, 100, 0.15);
  312. color: $color-white;
  313. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  314. }
  315. .avatar {
  316. float: left;
  317. margin-right: 0.9em;
  318. &:before {
  319. color: inherit;
  320. border-color: inherit;
  321. }
  322. }
  323. em {
  324. box-sizing: border-box;
  325. padding-right: 1.8em;
  326. margin-top: 1.2em;
  327. font-style: normal;
  328. font-weight: 700;
  329. width: 110px;
  330. overflow: hidden;
  331. white-space: nowrap;
  332. text-overflow: ellipsis;
  333. float: left;
  334. &:after {
  335. font-size: 1.5em;
  336. position: absolute;
  337. right: 0.25em;
  338. }
  339. }
  340. }
  341. }
  342. .nav-submenu {
  343. transform: translate3d(0, 0, 0);
  344. position: fixed;
  345. height: 100vh;
  346. width: 0;
  347. padding: 0;
  348. top: 0;
  349. left: $menu-width;
  350. overflow: hidden;
  351. display: flex;
  352. flex-direction: column;
  353. h2,
  354. &__list {
  355. width: $menu-width;
  356. }
  357. h2 {
  358. display: block;
  359. padding: 0.2em 0;
  360. font-size: 1.2em;
  361. font-weight: 500;
  362. text-transform: none;
  363. text-align: center;
  364. color: $color-menu-text;
  365. &:before {
  366. font-size: 4em;
  367. display: block;
  368. text-align: center;
  369. margin: 0 0 0.2em;
  370. width: 100%;
  371. opacity: 0.15;
  372. }
  373. }
  374. &__list {
  375. overflow: auto;
  376. flex-grow: 1;
  377. }
  378. &__footer {
  379. line-height: $nav-footer-closed-height;
  380. padding: 0;
  381. }
  382. }
  383. li.submenu-active {
  384. background: $nav-submenu-bg;
  385. > a {
  386. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  387. &:hover {
  388. background-color: transparent;
  389. }
  390. }
  391. .nav-submenu {
  392. @include transition(width 0.2s ease);
  393. box-shadow: 2px 0 2px rgba(0, 0, 0, 0.35);
  394. width: $menu-width;
  395. a {
  396. padding-left: 3.5em;
  397. }
  398. }
  399. }
  400. body.nav-open {
  401. .content-wrapper {
  402. position: relative;
  403. }
  404. }
  405. body.explorer-open {
  406. overflow: hidden;
  407. &:after {
  408. opacity: 1;
  409. visibility: visible;
  410. }
  411. .wrapper {
  412. transform: none;
  413. }
  414. .nav-wrapper {
  415. margin-left: 0;
  416. width: $menu-width;
  417. }
  418. .nav-main {
  419. display: block;
  420. }
  421. }
  422. }
  423. ///////////////
  424. // Z-indexes //
  425. ///////////////
  426. .nav-toggle {
  427. z-index: 5;
  428. }
  429. // stylelint-disable-next-line no-duplicate-selectors
  430. .nav-wrapper {
  431. z-index: 2;
  432. }
  433. // Avoiding a stacking context for the content-wrapper saves us a world
  434. // of pain when dealing with overlays that are appended to the end of
  435. // <body>, eg Hallo & calendars. As long as content-wrapper remains floated,
  436. // the z-index shouldn't be required.
  437. // .content-wrapper {
  438. // z-index: 3;
  439. // }
  440. // stylelint-disable-next-line no-duplicate-selectors
  441. .nav-submenu {
  442. z-index: 6;
  443. }
  444. footer,
  445. .logo {
  446. z-index: 100;
  447. }
  448. @include media-breakpoint-up(sm) {
  449. .nav-main {
  450. .nav-footer {
  451. z-index: 2;
  452. }
  453. }
  454. .nav-submenu {
  455. z-index: 500;
  456. }
  457. // Allows overspill of messages banner onto left menu, but also explorer
  458. // to spill over main content
  459. .nav-wrapper {
  460. z-index: auto;
  461. }
  462. // footer is z-index: 100, so ensure the navigation sits on top of it.
  463. .nav-wrapper.submenu-active {
  464. z-index: 200;
  465. }
  466. }