add : page tout savoir récupération des produits
This commit is contained in:
1 parent
99ac2e0b79
commit
7827aa119f
2 files changed
+29
-46
No files matched your search
+28
-45
@@ -5,8 +5,31 @@ import style from '../styles/ToutSavoir.module.css'
|
||||
|
||||
|
||||
import test from '../public/images/coffret-the-PhotoRoom.webp';
|
||||
import prisma from "../lib/prisma";
|
||||
|
||||
const ToutSavoir = () => {
|
||||
export async function getStaticProps() {
|
||||
const produits = await prisma.produit.findMany();
|
||||
|
||||
return {
|
||||
props: {
|
||||
produits,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type Props = {
|
||||
produits: Produit[];
|
||||
}
|
||||
|
||||
type Produit = {
|
||||
id: number;
|
||||
actif: boolean;
|
||||
nomProduit: string;
|
||||
prixTtc: number;
|
||||
}
|
||||
|
||||
const ToutSavoir = ({ produits }: Props) => {
|
||||
console.log('p', produits);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -29,7 +52,8 @@ const ToutSavoir = () => {
|
||||
Le jeu concours vous est proposé à l'occasion de ...
|
||||
</p>
|
||||
<div className="row">
|
||||
<div className="col-6 col-lg-3 d-flex justify-content-center my-2 my-lg-3">
|
||||
{produits.map((produit: Produit) => {
|
||||
return <div className="col-6 col-lg-3 d-flex justify-content-center my-2 my-lg-3" key={produit.id}>
|
||||
<div className={`${style.aCard} card`}>
|
||||
<Image
|
||||
className="card-img-top" src={test}
|
||||
@@ -38,53 +62,12 @@ const ToutSavoir = () => {
|
||||
alt="produit"
|
||||
/>
|
||||
<div className="card-body">
|
||||
<h5 className="card-title">Card title</h5>
|
||||
<p className="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-lg-3 d-flex justify-content-center my-2 my-lg-3">
|
||||
<div className={`${style.aCard} card`}>
|
||||
<Image
|
||||
className="card-img-top" src={test}
|
||||
width="286"
|
||||
height="180"
|
||||
alt="produit"
|
||||
/>
|
||||
<div className="card-body">
|
||||
<h5 className="card-title">Card title</h5>
|
||||
<p className="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-lg-3 d-flex justify-content-center my-2 my-lg-3">
|
||||
<div className={`${style.aCard} card`}>
|
||||
<Image
|
||||
className="card-img-top" src={test}
|
||||
width="286"
|
||||
height="180"
|
||||
alt="produit"
|
||||
/>
|
||||
<div className="card-body">
|
||||
<h5 className="card-title">Card title</h5>
|
||||
<p className="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6 col-lg-3 d-flex justify-content-center my-2 my-lg-3">
|
||||
<div className={`${style.aCard} card`}>
|
||||
<Image
|
||||
className="card-img-top" src={test}
|
||||
width="286"
|
||||
height="180"
|
||||
alt="produit"
|
||||
/>
|
||||
<div className="card-body">
|
||||
<h5 className="card-title">Card title</h5>
|
||||
<h5 className="card-title">{produit.nomProduit}</h5>
|
||||
<p className="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -93,7 +93,7 @@ model Produit {
|
||||
id Int @id @default(autoincrement())
|
||||
actif Boolean?
|
||||
nomProduit String?
|
||||
prixTtc Decimal?
|
||||
prixTtc Int?
|
||||
refGain Gain[]
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user