program calendar - disable empty sections

This commit is contained in:
isUnknown 2024-09-24 12:15:12 +02:00
parent ee2d1c66cd
commit dad7086465
3 changed files with 37 additions and 2 deletions

View file

@ -26,6 +26,10 @@
cursor: progress !important; cursor: progress !important;
} */ } */
.unvisible {
opacity: 0 !important;
}
.grid { .grid {
--column-gap: calc(var(--space-m) * 1.1); --column-gap: calc(var(--space-m) * 1.1);
--row-gap: calc(var(--space-m) / 2); --row-gap: calc(var(--space-m) / 2);
@ -112,7 +116,8 @@
.arrow-right { .arrow-right {
font-size: 2rem; font-size: 2rem;
transform: rotate(0deg); transform: rotate(0deg);
transition: transform 0.3s var(--curve-quick); opacity: 1;
transition: all 0.3s var(--curve-quick);
} }
.arrow-right.open { .arrow-right.open {

View file

@ -233,6 +233,10 @@ input {
cursor: progress !important; cursor: progress !important;
} */ } */
.unvisible {
opacity: 0 !important;
}
.grid { .grid {
--column-gap: calc(var(--space-m) * 1.1); --column-gap: calc(var(--space-m) * 1.1);
--row-gap: calc(var(--space-m) / 2); --row-gap: calc(var(--space-m) / 2);
@ -319,7 +323,8 @@ input {
.arrow-right { .arrow-right {
font-size: 2rem; font-size: 2rem;
transform: rotate(0deg); transform: rotate(0deg);
transition: transform 0.3s var(--curve-quick); opacity: 1;
transition: all 0.3s var(--curve-quick);
} }
.arrow-right.open { .arrow-right.open {

View file

@ -8,6 +8,25 @@
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const tab = urlParams.get('tab'); const tab = urlParams.get('tab');
return tab; return tab;
},
disableEmptySections() {
setTimeout(() => {
const sections = document.querySelectorAll('.collapsable')
sections.forEach(section => {
const sessions = section.querySelector('.sessions li')
const toggleBtn = section.querySelector('.toggle')
if (sessions) {
toggleBtn.removeAttribute('disabled')
toggleBtn.setAttribute('title', '')
toggleBtn.querySelector('.arrow-right').classList.remove('unvisible')
} else {
toggleBtn.setAttribute('disabled', true)
toggleBtn.setAttribute('title', 'aucune séance')
toggleBtn.querySelector('.arrow-right').classList.add('unvisible')
}
})
})
} }
}" }"
> >
@ -16,6 +35,12 @@
tab: setInitialTab(), tab: setInitialTab(),
filter: null filter: null
}" }"
x-init="
disableEmptySections()
$watch('tab', value => {
disableEmptySections()
})
"
> >