Adiciona barra social lateral ao tema do microsite

Implementa o layout estilo Olivero: em desktop (≥ 1200 px) a região
Social fica fixada à esquerda com conteúdo girado −90°; em mobile exibe
barra horizontal compacta. Usa IntersectionObserver para aplicar
.is-fixed ao scroll.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 10:38:54 -03:00
parent d169052065
commit 0b137e8d12
5 changed files with 145 additions and 12 deletions

View File

@@ -0,0 +1,35 @@
/**
* @file
* Barra social — comportamento de fixação ao scroll (estilo Olivero).
*
* Aplica a classe .is-fixed ao elemento .social-bar__inner quando o cabeçalho
* do micro-site sai do viewport, no breakpoint desktop (≥ 1200px).
*/
((Drupal) => {
const socialBarInner = document.querySelector(
'[data-drupal-selector="social-bar-inner"]',
);
if (!socialBarInner) return;
const navBreakpoint = window.matchMedia('(min-width: 1200px)');
function updateFixed(entries) {
if (!navBreakpoint.matches) {
socialBarInner.classList.remove('is-fixed');
return;
}
entries.forEach((entry) => {
socialBarInner.classList.toggle('is-fixed', entry.intersectionRatio < 1);
});
}
const header = document.querySelector('.microsite-header');
if (header) {
const observer = new IntersectionObserver(updateFixed, {
threshold: [0.999, 1],
});
observer.observe(header);
}
})(Drupal);