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,67 @@
|
||||
/**
|
||||
* Funzioni di formattazione condivise (indirizzi, orari, link telefonici e mappe).
|
||||
*/
|
||||
import type { Phone, PostalAddress } from '../data/studio';
|
||||
import { studio } from '../data/studio';
|
||||
|
||||
/** «Via XX Settembre, 163 — 14048 Montegrosso d’Asti (AT)» */
|
||||
export function addressLine(a: PostalAddress): string {
|
||||
return `${a.streetAddress} — ${a.postalCode} ${a.locality} (${a.province})`;
|
||||
}
|
||||
|
||||
/** «14048 Montegrosso d’Asti (AT)» */
|
||||
export function cityLine(a: PostalAddress): string {
|
||||
return `${a.postalCode} ${a.locality} (${a.province})`;
|
||||
}
|
||||
|
||||
export function telHref(phone: Phone): string {
|
||||
return `tel:${phone.e164}`;
|
||||
}
|
||||
|
||||
export function mailtoHref(email: string, subject?: string): string {
|
||||
return subject ? `mailto:${email}?subject=${encodeURIComponent(subject)}` : `mailto:${email}`;
|
||||
}
|
||||
|
||||
/** Fasce orarie leggibili: «9:00 – 12:30 | 15:00 – 18:30». */
|
||||
export function hoursLine(): string {
|
||||
const short = (t: string) => t.replace(/^0/, '');
|
||||
return studio.orari.fasce.map((f) => `${short(f.apertura)} – ${short(f.chiusura)}`).join(' | ');
|
||||
}
|
||||
|
||||
/** Ricerca per indirizzo (le coordinate non sono verificate, brief §4.6). */
|
||||
export function googleMapsUrl(query: string): string {
|
||||
return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`;
|
||||
}
|
||||
|
||||
export function googleDirectionsUrl(query: string): string {
|
||||
return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(query)}`;
|
||||
}
|
||||
|
||||
export function openStreetMapUrl(query: string): string {
|
||||
return `https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`;
|
||||
}
|
||||
|
||||
/** Dominio leggibile di un URL esterno (es. «agenziaentrate.gov.it»). */
|
||||
export function displayDomain(url: string): string {
|
||||
return new URL(url).hostname.replace(/^www\./, '');
|
||||
}
|
||||
|
||||
/** Data in italiano: «15 ottobre 2026». */
|
||||
export function formatDateIt(date: Date): string {
|
||||
return new Intl.DateTimeFormat('it-IT', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
timeZone: 'Europe/Rome',
|
||||
}).format(date);
|
||||
}
|
||||
|
||||
/** Iniziali per l'avatar: «Dott.ssa Giulia Grasso» → «GG». */
|
||||
export function initials(name: string): string {
|
||||
return name
|
||||
.replace(/^(Dott\.ssa|Dott\.|Avv\.|Rag\.)\s+/i, '')
|
||||
.split(/\s+/)
|
||||
.map((p) => p.charAt(0).toUpperCase())
|
||||
.join('')
|
||||
.slice(0, 2);
|
||||
}
|
||||
Reference in new issue
Block a user