connexion a l'api d'avis

This commit is contained in:
2023-02-12 14:58:39 +01:00
parent 4e807430d1
commit 096f056e41
12 changed files with 195 additions and 83 deletions

View File

@@ -3,7 +3,8 @@ import { Card, Col, Row, Table } from 'react-bootstrap';
import { BsPersonFill } from 'react-icons/bs';
import styles from '../styles/Avis.module.css'
export default function Avis({ age, sex, text, date, grade, gradeOther }) {
export default function Avis({review}) {
const {date, note_principale,notes_autres, commentaire, sexe_auteur, nom_source, age_auteur} = review;
return (
<Card>
<Card.Title>Avis</Card.Title>
@@ -14,9 +15,10 @@ export default function Avis({ age, sex, text, date, grade, gradeOther }) {
<BsPersonFill className={styles.personIcon} />
</Col>
<Col className='d-flex flex-column'>
<p>Age : {age}</p>
<p>Sexe : {sex}</p>
<p>Age : {age_auteur}</p>
<p>Sexe : {sexe_auteur}</p>
<p>Date de publication : {date}</p>
<p>Source : {nom_source}</p>
</Col>
</Row>
<Row>
@@ -31,12 +33,12 @@ export default function Avis({ age, sex, text, date, grade, gradeOther }) {
<tbody>
<tr>
<td>Général</td>
<td>{grade} / 10</td>
<td>{note_principale} / 10</td>
</tr>
{gradeOther.map(({ title, grade }) => {
return <tr key={title}>
<td>{title}</td>
<td>{grade}/10</td>
{notes_autres && notes_autres.map(({ critere, note }) => {
return <tr key={critere}>
<td>{critere}</td>
<td>{note}/10</td>
</tr>
})}
</tbody>
@@ -46,7 +48,7 @@ export default function Avis({ age, sex, text, date, grade, gradeOther }) {
<Card>
<Card.Header>Commentaire</Card.Header>
<Card.Body>
{text}
{commentaire}
</Card.Body>
</Card>
</Row>