_main-nav.scss 12 KB

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