ldc-bien-etre-animal/resources/ts/front/Components/DemarcheSection.tsx
2026-09-08 13:17:18 +02:00

200 lines
5.9 KiB
TypeScript

import { ArrowRight } from "lucide-react";
import heartImg from "&/images/globals/coeurFooter.svg";
import demarcheBg from "&/images/globals/ligne Bleu.svg";
import demarcheBgMobile from "&/images/globals/ligne_bleu_mobile.svg";
import badgeImage from "&/images/globals/logo_developped.png";
import badgeImageWebp from "&/images/globals/logo_developped.webp";
import chickPhoto from "&/images/globals/poussin.png";
import chickPhotoWebp from "&/images/globals/poussin.webp";
import CtaButton from "@/front/Components/Layout/CtaButton";
import Heading from "@/front/Components/Layout/Heading";
import useDeviceType from "@/hooks/use-device-type";
import { GetTranslation } from "@/lib/utils";
const DEMARCHE_BREAKPOINT = 1450;
export default function DemarcheSection() {
const { isCompact } = useDeviceType(DEMARCHE_BREAKPOINT);
const headingBlock = (
<div className="mx-auto w-fit bg-white px-4 py-2">
<Heading
level="h2"
color="text-bleu"
className="text-center"
fontFamily="font-lato-black"
>
{GetTranslation("home_page.demarche.heading")}
</Heading>
</div>
);
const introBlock = (
<div
className="bg-white p-4 text-center font-poppins-regular text-body text-bleu"
dangerouslySetInnerHTML={{
__html: GetTranslation("home_page.demarche.intro"),
}}
/>
);
const badgeBlock = (
<div className="flex items-end gap-6">
<div className="relative w-full h-full -rotate-3 p-5">
<picture>
<source srcSet={badgeImageWebp} type="image/webp" />
<img
src={badgeImage}
alt=""
className="w-full md:w-fit object-contain"
/>
</picture>
</div>
<img
src={heartImg}
alt="coeur"
title="coeur"
className={`relative object-cover ${
isCompact
? "top-[-60px] right-[41px] w-16 rotate-[12deg]"
: "static right-0 top-0 w-32 rotate-0"
}`}
/>
</div>
);
const centerTextBlock = (
<div className="flex flex-col items-center gap-3 bg-white">
<p
className="p-4 text-center font-poppins-regular text-body text-bleu"
dangerouslySetInnerHTML={{
__html: GetTranslation("home_page.demarche.center_text.subtitle"),
}}
/>
<Heading
uppercase={false}
level={isCompact ? "h3" : "h2"}
color="text-bleu"
className="text-center"
>
{GetTranslation("home_page.demarche.center_text.title")}
</Heading>
</div>
);
const photoBlock = (
<picture className="mx-auto">
<source srcSet={chickPhotoWebp} type="image/webp" />
<img
src={chickPhoto}
alt=""
className="h-full w-full rotate-3 rounded-2xl object-cover"
/>
</picture>
);
const engagementsBlock = (
<>
<h2 className="bg-white font-lato-black text-h2 text-bleu py-8 text-center">
{GetTranslation("home_page.demarche.engagements_number")}{" "}
{GetTranslation("home_page.demarche.engagements_title")}
</h2>
<div className="bg-white p-4 mt-4">
<div
className="mt-4 font-poppins-regular text-body text-bleu"
dangerouslySetInnerHTML={{
__html: GetTranslation("home_page.demarche.engagements_text"),
}}
/>
</div>
</>
);
const closingBlock = (
<div
className={`relative bg-white flex flex-col items-center text-center ${
isCompact ? "" : "pl-24 pt-1"
}`}
>
<div
className={`absolute top-20 right-0 h-5 w-5 rounded-full bg-bleu ${
isCompact ? "hidden" : "block"
}`}
/>
<h3 className="px-4 py-2 font-lato-bold text-h3 text-bleu max-w-xl">
{GetTranslation("home_page.demarche.closing_heading")}
</h3>
<div className="py-2">
<CtaButton
href={GetTranslation("home_page.demarche.cta_href")}
icon={<ArrowRight />}
iconPosition="right"
color="rouge"
className="p-4"
>
{GetTranslation("home_page.demarche.cta_label")}
</CtaButton>
</div>
</div>
);
if (isCompact) {
return (
<section className="relative w-full pb-2 mt-12">
<div className="pointer-events-none absolute inset-x-0 top-0 bottom-0 z-0 h-auto w-full">
<img
src={demarcheBgMobile}
alt=""
className="object-cover object-top"
/>
</div>
<div className="relative z-10 mx-auto flex container flex-col gap-16 px-4">
<div className="flex flex-col gap-14">
{headingBlock}
{photoBlock}
{centerTextBlock}
{introBlock}
{engagementsBlock}
{badgeBlock}
{closingBlock}
</div>
</div>
</section>
);
}
return (
<section className="relative w-full pt-12 pb-2 mt-12">
<div className="pointer-events-none absolute inset-x-0 top-0 bottom-0 z-0 h-auto w-full">
<img
src={demarcheBg}
alt=""
className="object-cover object-top h-[1675px] origin-top scale-y-75"
/>
</div>
<div className="relative z-10 mx-auto flex container flex-col gap-16 px-4 xl:pl-32">
<div className="grid grid-cols-[441px_441px_441px] gap-y-14 justify-center gap-x-10 items-stretch">
<div className="flex flex-col justify-between gap-10 -ml-[110px] min-h-[476px] w-[441px] text-center">
{headingBlock}
{introBlock}
{badgeBlock}
</div>
<div className="flex items-center justify-center min-h-[476px] w-[441px] text-center">
{centerTextBlock}
</div>
<div className="flex flex-col gap-10 -mr-[120px] min-h-[476px] w-[441px] text-center mt-12">
{photoBlock}
{engagementsBlock}
</div>
</div>
<div className="block">{closingBlock}</div>
</div>
</section>
);
}