From 6761b6358d2b92b9370325862e4b9fa650bff757 Mon Sep 17 00:00:00 2001 From: "Rayyan (Rayy)" Date: Tue, 14 Nov 2023 10:02:21 +0000 Subject: [PATCH] Add Book Review Form to Book Detail Page --- src/pages/Detail.js | 46 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/src/pages/Detail.js b/src/pages/Detail.js index cb5c668..fbce216 100644 --- a/src/pages/Detail.js +++ b/src/pages/Detail.js @@ -1,33 +1,35 @@ import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; +import Form from 'react-bootstrap/Form'; import Container from "react-bootstrap/Container"; import { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { ItemImage } from '../components/ItemImage'; +import Button from 'react-bootstrap/Button'; export function Detail(props) { const [bookData, setBookData] = useState() let { id } = useParams(); - useEffect( () => { - if( !bookData ) { - props.handler(id).then( (book) => setBookData(book) ) + useEffect(() => { + if (!bookData) { + props.handler(id).then((book) => setBookData(book)) } }, [id]) - if( bookData ) { - return( + if (bookData) { + return ( -

{bookData.book_title}

+

{bookData.book_title}

- +

More information

@@ -36,14 +38,40 @@ export function Detail(props) {

Author

{bookData.author}

ISBN

-

ISBN10 {bookData.isbn10}

-

ISBN13 {bookData.isbn13}

+

ISBN10: {bookData.isbn10}

+

ISBN13: {bookData.isbn13}

+
+

Review this book

+ + Star + + + + + + + + + + Title + + + + Review + + + +
+ + +
) } else { return null } + } \ No newline at end of file