_main-nav.scss 12 KB

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