require('../../vendor/cubist/cms-back/src/public/emailobfuscator/emailobfuscator');
require('element-closest');
-// Todo: WIP for CSS vars - need to assess MMenu usage and options for the polyfill. In default state, it's only partially working so it's better to disable this until it fully works.
-//import cssVars from 'css-vars-ponyfill';
-//cssVars({}); // Polyfill CSS Vars for older browsers
+// Polyfill CSS Vars for older browsers
+// This is only partly useful because we need to update CSS variables
+// via JS (--header-height) and this is too resource intensive because
+// it is in a scroll listener, so instead we make use of the
+// .header-minimized class that is applied and add extra rules to manage
+// the two possible header heights. It requires some variable duplication
+// but it's a reasonable compromise given the constraints...
+import cssVars from 'css-vars-ponyfill';
+cssVars({});
var glob = require('glob');
function getBodyScrollTop() {
const el = document.scrollingElement || document.documentElement;
- return el.scrollTop
+ return el.scrollTop;
}
document.addEventListener('scroll', function () {
} else {
document.body.classList.remove('header-minimized');
}
- document.querySelector('html').style.setProperty('--header-height', window.headerHeight + 'px');
+
+ document.documentElement.style.setProperty('--header-height', window.headerHeight + 'px');
+
+ // CSS vars could be updated here for older browsers but the performance cost
+ // is too much, especially with a scroll event like this...
+ // cssVars({
+ // variables: {
+ // '--header-height': window.headerHeight + 'px'
+ // }
+ // });
}
checkScroll();
//=== MMenu Setup
-import MmenuLight from 'mmenu-light/dist/js/mmlight';
-import offcanvas from 'mmenu-light/dist/js/mmlight.offcanvas';
+import MmenuLight from 'mmenu-light/bin/js/mmlight';
+import offcanvas from 'mmenu-light/bin/js/mmlight.offcanvas';
MmenuLight.prototype.offcanvas = offcanvas;
if (null === document.querySelector('.mm--close')) {
let search = document.querySelector('.mm li[data-name="recherche"] a');
- if(search!==null) {
+ if (search !== null) {
let searchIcon = document.getElementById('nav-search-toggle-link').innerHTML;
search.innerHTML = searchIcon + search.innerHTML;
}
});
setInterval(function () {
- checkOpenSubmenu()
+ checkOpenSubmenu();
}, 250);
}
}
// PMI Global Styles
+:root
+ --transition-duration: $transition-duration
+ --header-height: $header-height
body
min-width: 320px
$base-width = 1920px // Basis for vw unit calculations on large screens
$content-max-width = $base-width * 0.9 // Allows 5% either side
+$header-height = 134px
+$header-height-minimized = 60px
+$transition-duration = 500ms
+
// Gutters (assumed to always be a vw, vh or % unit)
$horizontal-gutter = 5vw
$vertical-gutter = 5vw
&-title
background-color: #314D6E
- height: var(--header-height)
+ height: $header-height
transition: height var(--transition-duration)
+ .header-minimized &
+ height: $header-height-minimized
+
&-content
// Fill available height if needed. Footer of popout is 139px tall
max-height: calc(100vh - var(--header-height) - 139px)
-$header-height = 134px
-
#header-placeholder
- height: $header-height
+ height: $header-height // Static value otherwise it causes problems with mini-header
.template-home &
background-color:theme('colors.navy')
.site-header
- --transition-duration: 500ms
@apply bg-navy text-white text-lg font-display font-medium antialiased fixed top-0
transition: height var(--transition-duration)
width: 100%
z-index: 100
- height: $header-height
+ height: var(--header-height)
.container
transition: padding-top var(--transition-duration), padding-bottom var(--transition-duration)
//=== Mini header
.header-minimized &
- height: 60px
+ height: $header-height-minimized
.container
padding-top: 8px
+below($breakpoint-menu)
#mobile-menu-icon
- --transition-duration: 500ms
-
display: block !important
cursor: pointer
flex-shrink: 0
&:before
opacity: 1
+
+
+// IE 11 styles
+.mm--vertical
+ &:after
+ height: $header-height
+ content: attr(data-mm-title) !important
+ display: block !important
+
+ .header-minimized &
+ height: $header-height-minimized
+
+ .mm--close
+ position: relative
+
+ .header-minimized &
+ height: $header-height-minimized
grid-template-areas: "image sidebar" "body sidebar"
grid-column-gap: 5vw
- +below(700px)
+ +below(768px)
grid-template-areas: "image" "body" "sidebar"
grid-row-gap: 5vw
</full-width>
@show
- <main class="flex-grow h-full">
+ <main class="flex-grow min-h-full">
@yield('content')
</main>
// Transpile code for older browsers like IE11
// This has to be here because if it is in the default setup,
// it seems to cause BrowserSync to go into an infinite loop :(
+ // UPDATE: This only seems to be needed for iOS 9 now...
mix.babel(['public/js/app.js'], 'public/js/app.js');
}
minimist "0.0.8"
mmenu-light@^2.1.1:
- version "2.1.1"
- resolved "https://registry.yarnpkg.com/mmenu-light/-/mmenu-light-2.1.1.tgz#8e20f294c6388814ffb86622025cd9ac8b408584"
- integrity sha512-cLycH5h0jfVvA5NNM4ckzeo3rzRh4e3sILnNn7ntXBLxZPL9cO4oTYDrHKDQHa2wBbc040X9rJgM+7rhaEzg4Q==
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/mmenu-light/-/mmenu-light-2.3.1.tgz#c472f0b8da92528c7e1957cd5b62ab7803c445d7"
+ integrity sha512-t9rC8F/JQbP4xpjX8avEpu7cLtq1hMeKtiMt0H8wHDC61sGQy42C46ojXdXbRA9Sgz202x2kqdKwLLMow4IC2g==
modernizr-webpack-plugin@^1.0.7:
version "1.0.7"