perf(storefront): optimize LCP image delivery, lazy-load scripts, improve WCAG contrast and accessibility
This commit is contained in:
1 parent
b766b01713
commit
98e20269a3
8 files changed
+77
-57
No files matched your search
@@ -147,15 +147,15 @@ export default function HomeClient({ initialData }: HomeClientProps) {
|
||||
{toPersian(idx + 1)}
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="text-lg font-bold text-medical-gray-900 mb-1 font-shabnam">{item.title}</h4>
|
||||
<p className="text-sm text-medical-gray-500 leading-relaxed font-medium font-sans">{item.desc}</p>
|
||||
<h3 className="text-lg font-bold text-medical-gray-900 mb-1 font-shabnam">{item.title}</h3>
|
||||
<p className="text-sm text-slate-700 leading-relaxed font-medium font-sans">{item.desc}</p>
|
||||
{idx === 0 && (
|
||||
<span className="text-[10px] text-slate-400 mt-1 block">
|
||||
<span className="text-[10px] text-slate-600 mt-1 block font-medium">
|
||||
* تهیه شده با بالاترین استانداردهای دارویی انسان - کاملاً بیخطر در صورت لیسیده شدن توسط حیوان.
|
||||
</span>
|
||||
)}
|
||||
{idx === 2 && (
|
||||
<span className="text-[10px] text-slate-400 mt-1 block">
|
||||
<span className="text-[10px] text-slate-600 mt-1 block font-medium">
|
||||
* تاییدیه رسمی ایمنی مواد غذایی و دارویی (HACCP & IFS) از اتحادیه اروپا.
|
||||
</span>
|
||||
)}
|
||||
@@ -172,13 +172,7 @@ export default function HomeClient({ initialData }: HomeClientProps) {
|
||||
|
||||
{/* Call to Action */}
|
||||
<section className="bg-canina-blue py-12 relative overflow-hidden font-sans">
|
||||
<div className="absolute inset-0 opacity-10">
|
||||
<div className="grid grid-cols-10 h-full w-full">
|
||||
{Array.from({ length: 100 }).map((_, i) => (
|
||||
<div key={i} className="border border-white/20" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="absolute inset-0 opacity-10 bg-[radial-gradient(#fff_1px,transparent_1px)] [background-size:24px_24px]" />
|
||||
<div className="max-w-4xl mx-auto px-4 text-center relative z-10">
|
||||
<h2 className="text-3xl lg:text-5xl font-black text-white mb-8 leading-tight font-lalezar tracking-wide">
|
||||
{getText('cta_title', "میخواهید بدانید کدام محصول برای پت شما مناسبتر است؟")}
|
||||
|
||||
@@ -89,11 +89,11 @@
|
||||
--color-medical-gray-100: #F4F7F6; /* light warm gray for alternate sections */
|
||||
--color-medical-gray-200: #E5ECE9; /* light box background / border color */
|
||||
--color-medical-gray-300: #C2D5CE; /* subtle borders */
|
||||
--color-medical-gray-400: #9BC8CC; /* card backgrounds / accent borders */
|
||||
--color-medical-gray-500: #6B8B8E; /* secondary text */
|
||||
--color-medical-gray-600: #4A6366; /* muted dark text */
|
||||
--color-medical-gray-700: #2C3E42; /* deep text */
|
||||
--color-medical-gray-800: #19272B; /* very dark text */
|
||||
--color-medical-gray-400: #7A9B9F; /* card backgrounds / accent borders */
|
||||
--color-medical-gray-500: #445D60; /* secondary text - WCAG AA > 5.2:1 contrast */
|
||||
--color-medical-gray-600: #33484B; /* muted dark text */
|
||||
--color-medical-gray-700: #202F32; /* deep text */
|
||||
--color-medical-gray-800: #141F22; /* very dark text */
|
||||
--color-medical-gray-900: #060709; /* primary font color / logo */
|
||||
|
||||
/* Standardized Typography Scale */
|
||||
|
||||
@@ -159,6 +159,14 @@ export default async function RootLayout({
|
||||
|
||||
return (
|
||||
<html lang="fa" dir="rtl" className={`${vazirmatn.variable} ${lalezar.variable}`} suppressHydrationWarning>
|
||||
<head>
|
||||
<link rel="preconnect" href="https://api.canina.ir" crossOrigin="anonymous" />
|
||||
<link rel="dns-prefetch" href="https://api.canina.ir" />
|
||||
<link rel="preconnect" href="https://www.googletagmanager.com" crossOrigin="anonymous" />
|
||||
<link rel="dns-prefetch" href="https://www.googletagmanager.com" />
|
||||
<link rel="preconnect" href="https://scripts.clarity.ms" crossOrigin="anonymous" />
|
||||
<link rel="dns-prefetch" href="https://scripts.clarity.ms" />
|
||||
</head>
|
||||
<body className="min-h-screen bg-medical-gray-50 font-sans" suppressHydrationWarning>
|
||||
{/* Google Tag Manager (noscript fallback) */}
|
||||
{isGtmEnabled && (
|
||||
@@ -192,11 +200,11 @@ export default async function RootLayout({
|
||||
{children}
|
||||
</ClientLayout>
|
||||
|
||||
{/* Google Tag Manager Script */}
|
||||
{/* Google Tag Manager Script (Deferred to idle) */}
|
||||
{isGtmEnabled && (
|
||||
<Script
|
||||
id="google-tag-manager"
|
||||
strategy="afterInteractive"
|
||||
strategy="lazyOnload"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
@@ -209,16 +217,16 @@ export default async function RootLayout({
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Google Analytics 4 (GA4) Scripts */}
|
||||
{/* Google Analytics 4 (GA4) Scripts (Deferred to idle) */}
|
||||
{isGaEnabled && (
|
||||
<>
|
||||
<Script
|
||||
strategy="afterInteractive"
|
||||
strategy="lazyOnload"
|
||||
src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}
|
||||
/>
|
||||
<Script
|
||||
id="google-analytics"
|
||||
strategy="afterInteractive"
|
||||
strategy="lazyOnload"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
@@ -233,11 +241,11 @@ export default async function RootLayout({
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Microsoft Clarity Script */}
|
||||
{/* Microsoft Clarity Script (Deferred to idle) */}
|
||||
{clarityId && (
|
||||
<Script
|
||||
id="microsoft-clarity"
|
||||
strategy="afterInteractive"
|
||||
strategy="lazyOnload"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function(c,l,a,r,i,t,y){
|
||||
|
||||
Reference in new issue
Block a user