feat: add Head component for dynamic title in Scheda Annuncio page

This commit is contained in:
Marco Pedone 2025-09-01 11:37:43 +02:00
parent 06e156c314
commit cc5e80c3f6
2 changed files with 20 additions and 20 deletions

View file

@ -1,6 +1,5 @@
"use client"; "use client";
import Head from "next/head";
import { useRef } from "react"; import { useRef } from "react";
import { useReactToPrint } from "react-to-print"; import { useReactToPrint } from "react-to-print";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
@ -21,25 +20,20 @@ export function SchedaAnnuncioStampabile({ data }: { data: Annunci }) {
}); });
return ( return (
<> <div className="mx-auto max-w-4xl">
<Head> <div className="space-y-6">
<title>Scheda Annuncio {data.codice}</title> <div className="flex items-center justify-between">
</Head> <h1 className="text-2xl font-bold">Scheda Annuncio Stampabile</h1>
<div className="mx-auto max-w-4xl">
<div className="space-y-6">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">Scheda Annuncio Stampabile</h1>
<Button className="print:hidden" onClick={() => reactToPrintFn()}> <Button className="print:hidden" onClick={() => reactToPrintFn()}>
Stampa Stampa
</Button> </Button>
</div> </div>
<div ref={contentRef}> <div ref={contentRef}>
<SchedaAnnuncio data={data} /> <SchedaAnnuncio data={data} />
</div>
</div> </div>
</div> </div>
</> </div>
); );
} }

View file

@ -1,4 +1,5 @@
import type { GetServerSideProps } from "next"; import type { GetServerSideProps } from "next";
import Head from "next/head";
import { AreaRiservataLayout } from "~/components/Layout"; import { AreaRiservataLayout } from "~/components/Layout";
import { LoadingPage } from "~/components/loading"; import { LoadingPage } from "~/components/loading";
import { SchedaAnnuncioStampabile } from "~/components/schedaAnnuncioStampabile"; import { SchedaAnnuncioStampabile } from "~/components/schedaAnnuncioStampabile";
@ -27,9 +28,14 @@ const SchedaAnnuncioPage: NextPageWithLayout<PageProps> = ({
return <Status500 />; return <Status500 />;
} }
return ( return (
<div className="mx-auto w-full p-4"> <>
<SchedaAnnuncioStampabile data={data} /> <Head>
</div> <title>Scheda Annuncio {data.codice}</title>
</Head>
<div className="mx-auto w-full p-4">
<SchedaAnnuncioStampabile data={data} />
</div>
</>
); );
}; };