_main-nav.scss 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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. }
  221. }
  222. // Navigation open condition
  223. body.nav-open {
  224. .wrapper {
  225. transform: translate3d($menu-width, 0, 0);
  226. }
  227. .content-wrapper {
  228. position: fixed;
  229. }
  230. footer {
  231. bottom: 1px;
  232. }
  233. }
  234. // Explorer open condition, widens navigation area
  235. body.explorer-open {
  236. .wrapper {
  237. transform: translate3d($menu-width-max, 0, 0);
  238. }
  239. .nav-wrapper {
  240. margin-left: -$menu-width-max;
  241. width: $menu-width-max;
  242. }
  243. .nav-main {
  244. display: none;
  245. }
  246. }
  247. @include media-breakpoint-up(sm) {
  248. .wrapper,
  249. body.nav-open .wrapper {
  250. transform: none;
  251. padding-left: $menu-width;
  252. @include transition(padding-left $menu-transition-duration ease);
  253. }
  254. body.sidebar-collapsed .wrapper {
  255. padding-left: $menu-width-slim;
  256. }
  257. .nav-wrapper {
  258. // height and position necessary to force it to 100% height of screen (with some JS help)
  259. position: absolute;
  260. left: 0;
  261. height: 100%;
  262. margin-left: 0;
  263. .inner {
  264. height: 100%;
  265. position: fixed;
  266. width: $menu-width;
  267. z-index: $nav-wrapper-inner-z-index;
  268. }
  269. }
  270. .nav-toggle.unbutton {
  271. display: none;
  272. }
  273. .nav-main {
  274. overflow: auto;
  275. margin-bottom: $nav-footer-closed-height;
  276. @include transition(margin-bottom 0.2s ease);
  277. .nav-footer {
  278. position: fixed;
  279. width: $menu-width;
  280. bottom: 0;
  281. background-color: $nav-footer-submenu-bg;
  282. }
  283. .nav-footer-submenu {
  284. @include transition(max-height 0.2s ease);
  285. max-height: 0;
  286. }
  287. &--open-footer {
  288. margin-bottom: $nav-footer-open-height;
  289. .nav-footer-submenu {
  290. max-height: $nav-footer-submenu-height;
  291. }
  292. }
  293. .account {
  294. @include clearfix;
  295. background: $nav-footer-account-bg;
  296. color: $color-menu-text;
  297. text-transform: uppercase;
  298. display: block;
  299. cursor: pointer;
  300. &:hover {
  301. background-color: rgba(100, 100, 100, 0.15);
  302. color: $color-white;
  303. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  304. }
  305. .avatar {
  306. float: left;
  307. margin-right: 0.9em;
  308. &:before {
  309. color: inherit;
  310. border-color: inherit;
  311. }
  312. }
  313. em {
  314. box-sizing: border-box;
  315. padding-right: 1.8em;
  316. margin-top: 1.2em;
  317. font-style: normal;
  318. font-weight: 700;
  319. width: 110px;
  320. overflow: hidden;
  321. white-space: nowrap;
  322. text-overflow: ellipsis;
  323. float: left;
  324. &:after {
  325. font-size: 1.5em;
  326. position: absolute;
  327. right: 0.25em;
  328. }
  329. }
  330. }
  331. }
  332. .nav-submenu {
  333. transform: translate3d(0, 0, 0);
  334. position: fixed;
  335. height: 100vh;
  336. width: 0;
  337. padding: 0;
  338. top: 0;
  339. left: $menu-width;
  340. overflow: hidden;
  341. display: flex;
  342. flex-direction: column;
  343. h2,
  344. &__list {
  345. width: $menu-width;
  346. }
  347. h2 {
  348. display: block;
  349. padding: 0.2em 0;
  350. font-size: 1.2em;
  351. font-weight: 500;
  352. text-transform: none;
  353. text-align: center;
  354. color: $color-menu-text;
  355. &:before {
  356. font-size: 4em;
  357. display: block;
  358. text-align: center;
  359. margin: 0 0 0.2em;
  360. width: 100%;
  361. opacity: 0.15;
  362. }
  363. }
  364. &__list {
  365. overflow: auto;
  366. flex-grow: 1;
  367. }
  368. &__footer {
  369. line-height: $nav-footer-closed-height;
  370. padding: 0;
  371. }
  372. }
  373. li.submenu-active {
  374. background: $nav-submenu-bg;
  375. > a {
  376. text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.3);
  377. &:hover {
  378. background-color: transparent;
  379. }
  380. }
  381. .nav-submenu {
  382. @include transition(width 0.2s ease);
  383. box-shadow: 2px 0 2px rgba(0, 0, 0, 0.35);
  384. width: $menu-width;
  385. a {
  386. padding-left: 3.5em;
  387. }
  388. }
  389. }
  390. body.nav-open {
  391. .content-wrapper {
  392. position: relative;
  393. }
  394. }
  395. body.explorer-open {
  396. overflow: hidden;
  397. &:after {
  398. opacity: 1;
  399. visibility: visible;
  400. }
  401. .wrapper {
  402. transform: none;
  403. }
  404. .nav-wrapper {
  405. margin-left: 0;
  406. width: $menu-width;
  407. }
  408. .nav-main {
  409. display: block;
  410. }
  411. }
  412. }
  413. ///////////////
  414. // Z-indexes //
  415. ///////////////
  416. .nav-toggle {
  417. z-index: 5;
  418. }
  419. // stylelint-disable-next-line no-duplicate-selectors
  420. .nav-wrapper {
  421. z-index: 2;
  422. }
  423. // Avoiding a stacking context for the content-wrapper saves us a world
  424. // of pain when dealing with overlays that are appended to the end of
  425. // <body>, e.g. calendars. As long as content-wrapper remains floated,
  426. // the z-index shouldn't be required.
  427. // .content-wrapper {
  428. // z-index: 3;
  429. // }
  430. // stylelint-disable-next-line no-duplicate-selectors
  431. .nav-submenu {
  432. z-index: 6;
  433. }
  434. footer,
  435. .logo {
  436. z-index: 100;
  437. }
  438. @include media-breakpoint-up(sm) {
  439. .nav-main {
  440. .nav-footer {
  441. z-index: 2;
  442. }
  443. }
  444. .nav-submenu {
  445. z-index: 500;
  446. }
  447. // Allows overspill of messages banner onto left menu, but also explorer
  448. // to spill over main content
  449. .nav-wrapper {
  450. z-index: auto;
  451. }
  452. // footer is z-index: 100, so ensure the navigation sits on top of it.
  453. .nav-wrapper.submenu-active {
  454. z-index: 200;
  455. }
  456. }