From f4c350ad642c211a4ccbd0930d4391d99c129d07 Mon Sep 17 00:00:00 2001 From: AdrianoDev Date: Sun, 5 Jul 2026 15:54:29 +0200 Subject: [PATCH] feat: tag contenuti header, footer e form contatti --- src/components/ContactForm.astro | 28 +++++++++++++++------- src/components/Footer.astro | 27 +++++++++++---------- src/components/Header.astro | 7 +++--- src/data/content-seed.ts | 40 ++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/src/components/ContactForm.astro b/src/components/ContactForm.astro index fec0282..4616694 100644 --- a/src/components/ContactForm.astro +++ b/src/components/ContactForm.astro @@ -1,15 +1,25 @@ --- +import { t } from '../lib/content'; +import T from './content/T.astro'; interface Props { variant?: 'full' | 'footer' } const { variant = 'full' } = Astro.props; --- -
- - {variant === 'full' && } - {variant === 'full' && } - - + + + {variant === 'full' && } + {variant === 'full' && } + + - +
@@ -28,11 +38,11 @@ const { variant = 'full' } = Astro.props; body: JSON.stringify(Object.fromEntries(new FormData(form))), }); const data = await res.json(); - msg.textContent = res.ok ? 'Messaggio inviato, ti ricontatteremo al più presto.' : (data.error ?? 'Errore di invio, riprova più tardi.'); + msg.textContent = res.ok ? form.dataset.msgSuccess! : (data.error ?? form.dataset.msgErrorGeneric); msg.className = `form-msg ${res.ok ? 'form-msg--ok' : 'form-msg--err'}`; if (res.ok) form.reset(); } catch { - msg.textContent = 'Errore di rete, riprova più tardi.'; + msg.textContent = form.dataset.msgErrorNetwork!; msg.className = 'form-msg form-msg--err'; } msg.hidden = false; diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 1546466..dfbf28b 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,34 +1,37 @@ --- import { site } from '../data/site'; import ContactForm from './ContactForm.astro'; +import { t, contentImageUrl } from '../lib/content'; +import T from './content/T.astro'; const year = new Date().getFullYear(); --- diff --git a/src/components/Header.astro b/src/components/Header.astro index 6e722bb..33a0b4c 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,13 +1,14 @@ --- import { site } from '../data/site'; +import { t, contentImageUrl } from '../lib/content'; const path = Astro.url.pathname; ---