Compare commits
No commits in common. "c4d5cf6c9e5cfa0d71d52cef1dda693d87447234" and "421187c12876e66315d09596138e87930c66d9d5" have entirely different histories.
c4d5cf6c9e
...
421187c128
2188
composer.lock
generated
2188
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ parameters:
|
|||||||
#
|
#
|
||||||
# Not recommended in production environments
|
# Not recommended in production environments
|
||||||
# @default null
|
# @default null
|
||||||
auto_reload: null
|
auto_reload: true
|
||||||
# Twig cache:
|
# Twig cache:
|
||||||
#
|
#
|
||||||
# By default, Twig templates will be compiled and stored in the filesystem
|
# By default, Twig templates will be compiled and stored in the filesystem
|
||||||
|
@ -5,7 +5,6 @@ export const useLayoutStore = defineStore('layout', {
|
|||||||
minDesktopWidth: 992,
|
minDesktopWidth: 992,
|
||||||
isDesktop: Boolean,
|
isDesktop: Boolean,
|
||||||
isEtapeListRetracted: Boolean,
|
isEtapeListRetracted: Boolean,
|
||||||
isEtapeListeScrollable: false,
|
|
||||||
isHamburgerMenuOpen: false,
|
isHamburgerMenuOpen: false,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
@ -33,29 +32,41 @@ export const useLayoutStore = defineStore('layout', {
|
|||||||
animationToggle.classList.remove('hidden');
|
animationToggle.classList.remove('hidden');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
listeEtape.classList.remove('retracted');
|
listeEtape.classList.remove('retracted');
|
||||||
|
this.checkIfEtapeListeShouldScroll();
|
||||||
}, 300);
|
}, 300);
|
||||||
this.isEtapeListRetracted = false;
|
this.isEtapeListRetracted = false;
|
||||||
},
|
},
|
||||||
shouldEtapeListeScroll({ listeEtape, column, listeEtapeContent, header, animationToggle }) {
|
checkIfEtapeListeShouldScroll() {
|
||||||
|
const listeEtape = document.querySelector('#etapes-liste');
|
||||||
|
const column = document.querySelector('.layout__region--third');
|
||||||
|
|
||||||
const columnRect = column.getBoundingClientRect();
|
const columnRect = column.getBoundingClientRect();
|
||||||
const listeEtapeContentRect = listeEtapeContent.getBoundingClientRect();
|
|
||||||
const headerRect = header.getBoundingClientRect();
|
const listeEtapeContentRect = document.querySelector('#etapes-liste .item-list').getBoundingClientRect();
|
||||||
const animationToggleRect = animationToggle.getBoundingClientRect();
|
const headerRect = document.querySelector('.layout-container > header').getBoundingClientRect();
|
||||||
|
const animationToggleRect = document.querySelector('.animation-toggle-container').getBoundingClientRect();
|
||||||
|
|
||||||
const isIntersecting = headerRect.bottom >= (columnRect.height - listeEtapeContentRect.height) / 2;
|
const isIntersecting = headerRect.bottom >= (columnRect.height - listeEtapeContentRect.height) / 2;
|
||||||
|
|
||||||
this.toggleEtapeListScroll(isIntersecting, listeEtape, column, headerRect.height, animationToggleRect.top);
|
if (isIntersecting) {
|
||||||
},
|
this.enableEtapeListeScroll(listeEtape, column, headerRect.height, animationToggleRect.top);
|
||||||
toggleEtapeListScroll(isIntersecting, listeEtape, column, headerHeight, animationToggleTop) {
|
} else {
|
||||||
if (isIntersecting && !this.isEtapeListeScrollable
|
this.disableEtapeListeScroll(listeEtape, column);
|
||||||
|| !isIntersecting && this.isEtapeListeScrollable) {
|
|
||||||
listeEtape.classList.toggle('scrollable');
|
|
||||||
column.classList.toggle('liste-etapes-scrollable');
|
|
||||||
this.isEtapeListeScrollable = !this.isEtapeListeScrollable;
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
enableEtapeListeScroll(listeEtape, column, headerHeight, animationToggleTop) {
|
||||||
|
listeEtape.classList.add('scrollable');
|
||||||
|
column.classList.add('liste-etapes-scrollable');
|
||||||
|
|
||||||
listeEtape.style.marginTop = isIntersecting ? `${headerHeight}px` : 'unset';
|
listeEtape.style.marginTop = `${headerHeight}px`;
|
||||||
listeEtape.style.maxHeight = isIntersecting ? `calc(100vh - (100vh - ${animationToggleTop}px) - ${headerHeight}px)` : 'unset';
|
listeEtape.style.maxHeight = `calc(100vh - (100vh - ${animationToggleTop}px) - ${headerHeight}px)`;
|
||||||
|
},
|
||||||
|
disableEtapeListeScroll(listeEtape, column) {
|
||||||
|
listeEtape.classList.remove('scrollable');
|
||||||
|
column.classList.remove('liste-etapes-scrollable');
|
||||||
|
|
||||||
|
listeEtape.style.marginTop = 'unset';
|
||||||
|
listeEtape.style.maxHeight = 'unset';
|
||||||
},
|
},
|
||||||
setUpHamburgerToggle(menuBurger, menuContainer) {
|
setUpHamburgerToggle(menuBurger, menuContainer) {
|
||||||
const menuTitle = document.querySelector('#menu-title');
|
const menuTitle = document.querySelector('#menu-title');
|
||||||
@ -100,10 +111,6 @@ export const useLayoutStore = defineStore('layout', {
|
|||||||
this.isHamburgerMenuOpen = !this.isHamburgerMenuOpen;
|
this.isHamburgerMenuOpen = !this.isHamburgerMenuOpen;
|
||||||
}, 50);
|
}, 50);
|
||||||
}, 50);
|
}, 50);
|
||||||
},
|
|
||||||
setHeaderPosition(currentPageIsIndex) {
|
|
||||||
const header = document.querySelector('.layout-container > header');
|
|
||||||
header.style.position = currentPageIsIndex ? 'fixed' : 'relative';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -10,9 +10,7 @@ export const useMapStore = defineStore('mapState', {
|
|||||||
currentPlace: Object,
|
currentPlace: Object,
|
||||||
maxZoom: Number,
|
maxZoom: Number,
|
||||||
currentZoom: Number,
|
currentZoom: Number,
|
||||||
animationsAreEnabled: localStorage.getItem('animationsEnabled') !== null
|
animationsAreEnabled: true,
|
||||||
? JSON.parse(localStorage.getItem('animationsEnabled'))
|
|
||||||
: true,
|
|
||||||
animationDuration: 3,
|
animationDuration: 3,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
@ -57,18 +55,13 @@ export const useMapStore = defineStore('mapState', {
|
|||||||
},
|
},
|
||||||
toggleAnimation() {
|
toggleAnimation() {
|
||||||
this.animationsAreEnabled = !this.animationsAreEnabled;
|
this.animationsAreEnabled = !this.animationsAreEnabled;
|
||||||
localStorage.setItem('animationsEnabled', JSON.stringify(this.animationsAreEnabled));
|
|
||||||
},
|
},
|
||||||
checkReducedMotion() {
|
checkReducedMotion() {
|
||||||
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||||
if (mediaQuery.matches) {
|
this.animationsAreEnabled = !mediaQuery.matches;
|
||||||
this.animationsAreEnabled = false;
|
|
||||||
localStorage.setItem('animationsEnabled', JSON.stringify(this.animationsAreEnabled));
|
|
||||||
}
|
|
||||||
|
|
||||||
mediaQuery.addEventListener('change', (event) => {
|
mediaQuery.addEventListener('change', (event) => {
|
||||||
this.animationsAreEnabled = !event.matches;
|
this.animationsAreEnabled = !event.matches;
|
||||||
localStorage.setItem('animationsEnabled', JSON.stringify(this.animationsAreEnabled));
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -10,10 +10,8 @@ export async function initFirstLoadRouting(store, router, baseUrl, siteName) {
|
|||||||
window.localStorage.removeItem("decoupled_origin");
|
window.localStorage.removeItem("decoupled_origin");
|
||||||
document.title = store.pageTitle;
|
document.title = store.pageTitle;
|
||||||
setActiveNavItem(store.contentType, decoupled_origin.url);
|
setActiveNavItem(store.contentType, decoupled_origin.url);
|
||||||
useLayoutStore().setHeaderPosition(false);
|
|
||||||
} else {
|
} else {
|
||||||
document.title = siteName;
|
document.title = siteName;
|
||||||
useLayoutStore().setHeaderPosition(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,11 +40,9 @@ export async function pageChange(href, store, siteName, mapStore, baseUrl) {
|
|||||||
store.resetStore(true);
|
store.resetStore(true);
|
||||||
document.title = siteName;
|
document.title = siteName;
|
||||||
mapStore.resetMap();
|
mapStore.resetMap();
|
||||||
useLayoutStore().setHeaderPosition(true);
|
|
||||||
} else {
|
} else {
|
||||||
await store.fetchContentData(baseUrl + href);
|
await store.fetchContentData(baseUrl + href);
|
||||||
document.title = store.pageTitle;
|
document.title = store.pageTitle;
|
||||||
useLayoutStore().setHeaderPosition(false);
|
|
||||||
}
|
}
|
||||||
setActiveNavItem(store.contentType, href);
|
setActiveNavItem(store.contentType, href);
|
||||||
|
|
||||||
|
@ -4,30 +4,16 @@ export function handleReactiveness() {
|
|||||||
const layoutStore = useLayoutStore();
|
const layoutStore = useLayoutStore();
|
||||||
layoutStore.setupResizeListenner();
|
layoutStore.setupResizeListenner();
|
||||||
|
|
||||||
// toggle collapse and scroll for etape liste
|
(function setupEtapeListeCollapse() {
|
||||||
(function setEtapeListe() {
|
|
||||||
const listeEtape = document.querySelector('#etapes-liste');
|
|
||||||
const listeToggleButton = document.querySelector('#retractable-message');
|
const listeToggleButton = document.querySelector('#retractable-message');
|
||||||
const column = document.querySelector('.layout__region--third');
|
|
||||||
const header = document.querySelector('.layout-container > header');
|
const listeEtape = document.querySelector('#etapes-liste');
|
||||||
|
|
||||||
const animationToggle = document.querySelector('#animation-toggle');
|
const animationToggle = document.querySelector('#animation-toggle');
|
||||||
|
|
||||||
const EtapeListeScrollElements = {
|
|
||||||
listeEtape,
|
|
||||||
column,
|
|
||||||
listeEtapeContent: listeEtape.querySelector('.item-list'),
|
|
||||||
header,
|
|
||||||
animationToggle: animationToggle.querySelector('.animation-toggle-container')
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutStore.shouldEtapeListeScroll(EtapeListeScrollElements);
|
|
||||||
|
|
||||||
if (!layoutStore.isDesktop) layoutStore.collapseEtapeListe(listeEtape, animationToggle);
|
if (!layoutStore.isDesktop) layoutStore.collapseEtapeListe(listeEtape, animationToggle);
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
layoutStore.shouldEtapeListeScroll(EtapeListeScrollElements);
|
|
||||||
|
|
||||||
if (layoutStore.isDesktop && layoutStore.isEtapeListRetracted) {
|
if (layoutStore.isDesktop && layoutStore.isEtapeListRetracted) {
|
||||||
layoutStore.expandEtapeListe(listeEtape, animationToggle);
|
layoutStore.expandEtapeListe(listeEtape, animationToggle);
|
||||||
} else if (!layoutStore.isDesktop && !layoutStore.isEtapeListRetracted) {
|
} else if (!layoutStore.isDesktop && !layoutStore.isEtapeListRetracted) {
|
||||||
@ -41,11 +27,16 @@ export function handleReactiveness() {
|
|||||||
layoutStore.collapseEtapeListe(listeEtape, animationToggle);
|
layoutStore.collapseEtapeListe(listeEtape, animationToggle);
|
||||||
} else {
|
} else {
|
||||||
layoutStore.expandEtapeListe(listeEtape, animationToggle);
|
layoutStore.expandEtapeListe(listeEtape, animationToggle);
|
||||||
layoutStore.shouldEtapeListeScroll(EtapeListeScrollElements);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
layoutStore.checkIfEtapeListeShouldScroll();
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
layoutStore.checkIfEtapeListeShouldScroll();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setMenuToggle() {
|
export function setMenuToggle() {
|
||||||
|
@ -7,5 +7,4 @@ export function setupMapStore(mapStore, map, settings) {
|
|||||||
mapStore.defaultZoomDesktop = settings.settings.minZoom;
|
mapStore.defaultZoomDesktop = settings.settings.minZoom;
|
||||||
mapStore.defaultZoomMobile = settings.settings.minZoom - 1;
|
mapStore.defaultZoomMobile = settings.settings.minZoom - 1;
|
||||||
mapStore.map.flyTo([mapStore.defaultMapCenter.lat, mapStore.defaultMapCenter.lng], useLayoutStore().isDesktop ? mapStore.defaultZoomDesktop : mapStore.defaultZoomMobile);
|
mapStore.map.flyTo([mapStore.defaultMapCenter.lat, mapStore.defaultMapCenter.lng], useLayoutStore().isDesktop ? mapStore.defaultZoomDesktop : mapStore.defaultZoomMobile);
|
||||||
mapStore.checkReducedMotion();
|
|
||||||
}
|
}
|
@ -134,21 +134,21 @@ const handleMapMovement = () => {
|
|||||||
|
|
||||||
if (isModaleEtape) {
|
if (isModaleEtape) {
|
||||||
if (!wasModaleEtape) {
|
if (!wasModaleEtape) {
|
||||||
// national -> détail
|
console.log('national -> détail');
|
||||||
setModaleTransition(animationDuration.value);
|
setModaleTransition(animationDuration.value);
|
||||||
zoomToContentPlace();
|
zoomToContentPlace();
|
||||||
} else {
|
} else {
|
||||||
// détail -> détail
|
console.log('détail -> détail');
|
||||||
setModaleTransition(animationDuration.value);
|
setModaleTransition(animationDuration.value);
|
||||||
zoomToContentPlace();
|
zoomToContentPlace();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (wasModaleEtape) {
|
if (wasModaleEtape) {
|
||||||
// détail -> national
|
console.log('détail -> national');
|
||||||
setModaleTransition(animationDuration.value);
|
setModaleTransition(animationDuration.value);
|
||||||
mapState.resetMap();
|
mapState.resetMap();
|
||||||
} else {
|
} else {
|
||||||
// national -> national
|
console.log('national -> national');
|
||||||
setModaleTransition(0);
|
setModaleTransition(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<div class="titre">{{ content.previous.title }} <span>({{ content.previous.postalCode.slice(0, 2) }})</span></div>
|
<div class="titre">{{ content.previous.title }} <span>({{ content.previous.postalCode }})</span></div>
|
||||||
<div class="date">Du {{ content.previous.dates.start.d }} {{ content.previous.dates.start.m }}<br>au {{ content.previous.dates.end.d }} {{ content.previous.dates.end.m }} {{ content.previous.dates.end.y }}</div>
|
<div class="date">Du {{ content.previous.dates.start.d }} {{ content.previous.dates.start.m }}<br>au {{ content.previous.dates.end.d }} {{ content.previous.dates.end.m }} {{ content.previous.dates.end.y }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="vignette">
|
<div class="vignette">
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="infos">
|
<div class="infos">
|
||||||
<div class="titre">{{ content.next.title }} <span>({{ content.next.postalCode.slice(0, 2) }})</span></div>
|
<div class="titre">{{ content.next.title }} <span>({{ content.next.postalCode }})</span></div>
|
||||||
<div class="date">Du {{ content.next.dates.start.d }} {{ content.next.dates.start.m }}<br>au {{ content.next.dates.end.d }} {{ content.next.dates.end.m }} {{ content.next.dates.end.y }}</div>
|
<div class="date">Du {{ content.next.dates.start.d }} {{ content.next.dates.start.m }}<br>au {{ content.next.dates.end.d }} {{ content.next.dates.end.m }} {{ content.next.dates.end.y }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="vignette">
|
<div class="vignette">
|
||||||
|
@ -53,6 +53,7 @@ body{
|
|||||||
.layout-container {
|
.layout-container {
|
||||||
> header {
|
> header {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
position: fixed;
|
||||||
> div {
|
> div {
|
||||||
padding: $body-margin-y $body-margin-x 0 $body-margin-x;
|
padding: $body-margin-y $body-margin-x 0 $body-margin-x;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user