Add mobile-only toggle to show and hide Meldungen cards

This commit is contained in:
2026-05-28 11:12:52 +02:00
parent f5662ca1ed
commit 28274b7f48
2 changed files with 31 additions and 0 deletions
+23
View File
@@ -111,6 +111,9 @@
<aside class="sg-vsf-list-detail-page__left-column" aria-label="Benachrichtigungen">
<div class="sg-group-card" data-component="group-card">
<h2 class="sg-heading-h2 sg-text-on-dark sg-group-card__heading">Meldungen</h2>
<button class="sg-interaction-element sg-button sg-button--active sg-vsf-list-detail-page__mobile-toggle" type="button" data-toggle-target="meldungen" data-collapsed-label="Meldungen einblenden" data-expanded-label="Meldungen ausblenden" aria-expanded="true">
Meldungen ausblenden
</button>
<article class="sg-card" data-component="notification-card" data-component-context="group-card">
<div class="sg-card-segment sg-card-segment--header sg-card-segment--signal-red" data-component-part="card-header">
<p class="sg-body">
@@ -321,6 +324,26 @@
});
});
document.querySelectorAll('[data-toggle-target="meldungen"]').forEach((button) => {
button.addEventListener('click', () => {
const groupCard = button.closest('.sg-group-card');
if (!groupCard) {
return;
}
const cards = groupCard.querySelectorAll('[data-component="notification-card"]');
const isExpanded = button.getAttribute('aria-expanded') === 'true';
const nextExpanded = !isExpanded;
cards.forEach((card) => {
card.hidden = !nextExpanded;
});
button.setAttribute('aria-expanded', String(nextExpanded));
button.textContent = nextExpanded ? (button.dataset.expandedLabel || 'Meldungen ausblenden') : (button.dataset.collapsedLabel || 'Meldungen einblenden');
});
});
const updatePulldownSelectionState = (demo) => {
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
const selectableOptions = demo.querySelectorAll('[data-pulldown-option]');