diff --git a/README.md b/README.md
index 258a878..dbca118 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,21 @@
#### Setup
+DONE
Fork, clone, run yarn install, yarn start, pull request
#### Do
+DONE
* Add a new class component for Reviews
+DONE
* Make sure to use extends and super
+DONE
* Import and use this component in ProductDetail
+DONE
* This component will take a product from props
+DONE
* It will show the number of reviews followed by "review" or "reviews" depending on if there is one or more reviews
- * It will create a list of the reviews description which will inititally be hidden
+ DONE
+ * It will create a list of the reviews description which will initially be hidden
+ DONE
* When the word "review" is clicked show the reviews
- * When clicked again, hide the reviews
\ No newline at end of file
+ DONE
+ * When clicked again, hide the reviews
diff --git a/src/App.js b/src/App.js
index 8dfa97f..d37bf15 100644
--- a/src/App.js
+++ b/src/App.js
@@ -8,7 +8,7 @@ import Carousel from './components/Carousel';
function App (props) {
var products = props.state.products.map(function(prod){
- return
15 reviews
+ +{stars}
diff --git a/src/components/Reviews.js b/src/components/Reviews.js new file mode 100644 index 0000000..f504a99 --- /dev/null +++ b/src/components/Reviews.js @@ -0,0 +1,43 @@ +import React from "react"; + +class Reviews extends React.Component{ + constructor (props) { + super(props); + this.state = { + visible: false, + }; + this.handleReviewClick = this.handleReviewClick.bind(this); + } + + handleReviewClick() { + this.setState(function(prevState) { + return { + visible: !prevState.visible + } + }); + } + + render() { + let reviews = this.props.product; + let numOfReviews = reviews.length; + + const reviewDiv = reviews.map((review) => { + if(this.state.visible) { + return ( +{review.description} {review.rating}
+