feat: design system, layout e componenti di base
- token, font self-hosted (Fraunces e Inter, sottoinsieme latin) con preload - BaseLayout con head completo (SEO, Open Graph, favicon) e JSON-LD dello studio - intestazione con barra superiore, navigazione e sottomenu servizi accessibili - menu mobile con dialog modale e alternativa senza JavaScript - footer con P.IVA, recapiti, servizi, orari e link legali - componenti: Logo, Icon (Lucide inline), Hero, card servizio, scheda professionista, badge abilitazione, card sede, mappa click-to-load, modulo di contatto, banda CTA, breadcrumb, intestazioni di sezione - generate-icons.mjs: marchio, favicon, apple-touch-icon e immagine OG - collection dei servizi e dei link utili con schemi Zod Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zJ9ZWGKvoKoxYwbmnRKdJ
This commit is contained in:
58 files changed
+5077
-16
No files matched your search
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Mappe Google caricate solo dopo il consenso esplicito (clic su «Carica la mappa»).
|
||||
* Nessun cookie: la scelta è ricordata in sessionStorage (dato tecnico, nessun dato personale)
|
||||
* e vale fino alla chiusura della scheda.
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = 'mappa-consentita';
|
||||
|
||||
function rememberConsent(): void {
|
||||
try {
|
||||
sessionStorage.setItem(STORAGE_KEY, '1');
|
||||
} catch {
|
||||
// sessionStorage non disponibile (es. navigazione privata restrittiva): nessun problema.
|
||||
}
|
||||
}
|
||||
|
||||
function hasConsent(): boolean {
|
||||
try {
|
||||
return sessionStorage.getItem(STORAGE_KEY) === '1';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function loadMap(block: HTMLElement, moveFocus: boolean): void {
|
||||
if (block.dataset.mapLoaded === 'true') return;
|
||||
const src = block.dataset.mapSrc;
|
||||
const frame = block.querySelector<HTMLElement>('[data-map-frame]');
|
||||
const placeholder = block.querySelector<HTMLElement>('[data-map-placeholder]');
|
||||
if (!src || !frame || !placeholder) return;
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.src = src;
|
||||
iframe.title = block.dataset.mapTitle ?? 'Mappa';
|
||||
iframe.loading = 'lazy';
|
||||
iframe.referrerPolicy = 'strict-origin-when-cross-origin';
|
||||
iframe.allowFullscreen = true;
|
||||
|
||||
frame.append(iframe);
|
||||
frame.hidden = false;
|
||||
placeholder.hidden = true;
|
||||
block.dataset.mapLoaded = 'true';
|
||||
if (moveFocus) iframe.focus();
|
||||
}
|
||||
|
||||
function init(): void {
|
||||
const blocks = Array.from(document.querySelectorAll<HTMLElement>('[data-map-consent]'));
|
||||
if (blocks.length === 0) return;
|
||||
|
||||
for (const block of blocks) {
|
||||
const button = block.querySelector<HTMLButtonElement>('[data-map-load]');
|
||||
button?.addEventListener('click', () => {
|
||||
rememberConsent();
|
||||
loadMap(block, true);
|
||||
});
|
||||
}
|
||||
|
||||
if (hasConsent()) for (const block of blocks) loadMap(block, false);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
export {};
|
||||
Reference in new issue
Block a user