/* Hadef & Partners — shared components */
const { useState, useEffect, useRef, useMemo, useCallback } = React;
const D = window.DATA;
const useT = () => {
const [, force] = useState(0);
useEffect(() => {
const f = () => force(n => n + 1);
window.addEventListener("locale-change", f);
return () => window.removeEventListener("locale-change", f);
}, []);
return (en, ar) => (window.LOCALE === "ar" ? ar : en);
};
/* === LOGO (inline SVG so we can recolor with currentColor) === */
function Logo({ light = false }) {
// simplified mark using firm's exact logo paths, retinted via CSS var
return (
);
}
/* === NAVBAR === */
function Navbar({ page, setPage, lang, setLang }) {
const t = useT();
const links = [
{ id: "home", en: "Home", ar: "الرئيسية", hidden: true },
{ id: "expertise", en: "Expertise", ar: "الخبرات" },
{ id: "people", en: "People", ar: "المحامون" },
{ id: "insights", en: "Insights", ar: "آراء قانونية" },
{ id: "about", en: "About", ar: "عن المكتب" },
{ id: "contact", en: "Contact", ar: "اتصل بنا" },
];
return (
);
}
/* === FOOTER === */
function Footer({ setPage }) {
const t = useT();
return (
);
}
/* === RANKINGS STRIP === */
function RankingsStrip({ inverted = false }) {
const t = useT();
return (
{t("Ranked by", "تصنيفنا لدى")}
{D.rankings.map((r,i) =>
{r.issuer}
{r.band} · {r.area} · {r.year}
)}
);
}
/* === Section Header === */
function SectionHead({ num, eyebrow, title, kicker, actions }) {
return (
{num}
{eyebrow}
{title}
{kicker &&
{kicker}
}
{actions &&
{actions}
}
);
}
/* === Practice Card === */
function PracticeCard({ practice, setPage, idx }) {
const t = useT();
return (
);
}
/* === Lawyer Card === */
function LawyerCard({ lawyer, setPage, large = false }) {
const t = useT();
return (
);
}
/* === Insight Card === */
function InsightCard({ insight, setPage, layout = "default" }) {
const t = useT();
const author = D.lawyers.find(l => l.slug === insight.author);
const dateFmt = new Date(insight.date).toLocaleDateString(window.LOCALE === 'ar' ? 'ar-AE' : 'en-GB',
{ day:'numeric', month:'long', year:'numeric' });
if (layout === "wide") {
return (
);
}
return (
);
}
/* === Sticky CTA Bar (mobile / scroll-revealed) === */
function StickyCTA({ setPage }) {
const t = useT();
const [show, setShow] = useState(false);
useEffect(() => {
const h = () => setShow(window.scrollY > 600);
window.addEventListener("scroll", h);
return () => window.removeEventListener("scroll", h);
}, []);
return (
);
}
Object.assign(window, {
Logo, Navbar, Footer, RankingsStrip, SectionHead,
PracticeCard, LawyerCard, InsightCard, StickyCTA, useT,
});