refactor(annunci_grid): Simplify CardAnnuncio props by spreading pagedata

This commit is contained in:
Marco Pedone 2025-11-03 15:50:40 +01:00
parent bb293bbd4a
commit 7a2e3eb862

View file

@ -4,32 +4,10 @@ import { useTranslation } from "~/providers/I18nProvider";
import type { AnnuncioRicerca } from "~/server/controllers/annunci.controller";
export const AnnunciGrid = ({ pagedata }: { pagedata: AnnuncioRicerca[] }) => {
const { locale } = useTranslation();
return (
<div className="relative z-0 mx-auto grid max-w-7xl grid-flow-row grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{pagedata.map((annuncio) => (
<CardAnnuncio
camere={annuncio.numero_camere}
codice={annuncio.codice}
comune={annuncio.comune}
consegna={annuncio.consegna}
id={annuncio.id}
images={annuncio.images}
key={annuncio.codice}
mq={annuncio.mq}
prezzo={annuncio.prezzo}
provincia={annuncio.provincia}
stato={annuncio.stato}
tipo={annuncio.tipo}
titolo={getTitoloTranslation({
locale: locale,
titolo_en: annuncio.titolo_en,
titolo_it: annuncio.titolo_it,
})}
updated_at={annuncio.updated_at}
videos={annuncio.url_video || undefined}
/>
<CardAnnuncio key={annuncio.codice} {...annuncio} />
))}
</div>
);