expanded nav - add program subcategories

This commit is contained in:
isUnknown 2024-09-10 18:36:50 +02:00
parent 952c81aaff
commit 3076394e19
3 changed files with 30 additions and 2 deletions

View file

@ -68,6 +68,9 @@
.expanded-nav__category {
margin-bottom: 1rem;
}
.expanded-nav__category .toggle {
display: none;
}
.expanded-nav__subcategory {
font-size: var(--font-size-s);
}

View file

@ -59,6 +59,11 @@
<li><a class="expanded-nav__subcategory" href="<?= $category->url() . '/#' . $subcategory->slug() ?>"><?= $subcategory->title() ?></a></li>
<?php endif ?>
<?php endforeach ?>
<?php if ($category->template() == 'program'): ?>
<?php foreach($category->categories()->split() as $subcategory): ?>
<li><a class="expanded-nav__subcategory" href="<?= $category->url() . '/?tab=Calendrier+—+' . urlencode($subcategory) ?>"><?= $subcategory ?></a></li>
<?php endforeach ?>
<?php endif ?>
</ul>
</li>
<?php endforeach ?>

View file

@ -24,7 +24,17 @@
x-data="{title: 'Calendrier'}"
x-text="title"
:class="tab === title ? 'strong' : ''"
@click="if (tab === title) { tab = 'Programme' } else {tab = title}"
@click="
if (tab === title) {
tab = 'Programme'
} else {
tab = title
}
const url = new URL(window.location.href);
url.searchParams.set('tab', tab);
window.history.pushState({}, '', url);
"
></button>
<?php foreach($page->categories()->split() as $filter): ?>
<button
@ -36,7 +46,17 @@
}"
x-text="title"
:class="tab === filterTitle ? 'strong' : ''"
@click="if (tab === filterTitle) { tab = 'Programme' } else { tab = filterTitle; filter = title }"
@click="
if (tab === filterTitle) {
tab = 'Programme'
} else {
tab = filterTitle; filter = title
}
const url = new URL(window.location.href);
url.searchParams.set('tab', tab);
window.history.pushState({}, '', url);
"
></button>
<?php endforeach ?>
</section>