_main-nav.scss 12 KB

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