Add layout 3 list card scaffold with small sandwich menu
This commit is contained in:
@@ -146,6 +146,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h2 class="sg-sub-heading sg-section-h2">Layout 3: List Card</h2>
|
||||||
|
<div class="sg-object-card-grid" aria-label="VSF List Card Layout List Card">
|
||||||
|
<article class="sg-card sg-object-card" data-pattern="object-group-card" aria-label="List Card">
|
||||||
|
<header class="sg-card-segment sg-card-segment--header sg-card-segment--darkblue sg-object-card__header" data-pattern-part="object-group-card-header">
|
||||||
|
<div class="sg-strong">Neue Liste anlegen</div>
|
||||||
|
<div class="sg-sandwich-menu-wrap" data-open="false" data-align="right" data-component="sandwich-menu" data-component-size="small">
|
||||||
|
<button class="sg-interaction-element sg-sandwich-button sg-sandwich-button--small" type="button" aria-expanded="false" aria-label="Menü öffnen" data-component-part="sandwich-trigger">
|
||||||
|
<span class="sg-sandwich-button__icon" aria-hidden="true">
|
||||||
|
<span class="sg-sandwich-button__line"></span>
|
||||||
|
<span class="sg-sandwich-button__line"></span>
|
||||||
|
<span class="sg-sandwich-button__line"></span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<div class="sg-sandwich-menu-panel" aria-label="Ausgeklapptes Menü" data-component-part="sandwich-panel">
|
||||||
|
<a class="sg-sandwich-menu-link" href="#">Menüpunkt</a>
|
||||||
|
<a class="sg-sandwich-menu-link" href="#">Menüpunkt</a>
|
||||||
|
<a class="sg-sandwich-menu-link" href="#">Menüpunkt</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="sg-card-segment sg-card-segment--gray sg-object-card__content" data-pattern-part="object-group-card-content"></div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -239,8 +263,43 @@
|
|||||||
});
|
});
|
||||||
updateProcessButtonState();
|
updateProcessButtonState();
|
||||||
|
|
||||||
|
document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {
|
||||||
|
const button = wrap.querySelector('.sg-sandwich-button');
|
||||||
|
const panel = wrap.querySelector('.sg-sandwich-menu-panel');
|
||||||
|
|
||||||
|
if (!button) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.addEventListener('click', (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
const nextState = wrap.dataset.open !== 'true';
|
||||||
|
|
||||||
|
document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((otherWrap) => {
|
||||||
|
const otherButton = otherWrap.querySelector('.sg-sandwich-button');
|
||||||
|
otherWrap.dataset.open = 'false';
|
||||||
|
if (otherButton) {
|
||||||
|
otherButton.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
wrap.dataset.open = String(nextState);
|
||||||
|
button.setAttribute('aria-expanded', String(nextState));
|
||||||
|
|
||||||
|
if (!nextState || !panel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrap.dataset.align = 'right';
|
||||||
|
const panelRect = panel.getBoundingClientRect();
|
||||||
|
if (panelRect.left < 0) {
|
||||||
|
wrap.dataset.align = 'left';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.addEventListener('click', (event) => {
|
document.addEventListener('click', (event) => {
|
||||||
if (event.target.closest('.sg-pulldown-demo')) {
|
if (event.target.closest('.sg-pulldown-demo') || event.target.closest('.sg-sandwich-menu-wrap')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,6 +310,14 @@
|
|||||||
trigger.setAttribute('aria-expanded', 'false');
|
trigger.setAttribute('aria-expanded', 'false');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {
|
||||||
|
const button = wrap.querySelector('.sg-sandwich-button');
|
||||||
|
wrap.dataset.open = 'false';
|
||||||
|
if (button) {
|
||||||
|
button.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user