Skip to content

Commit

Permalink
reposition comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky1638 committed Sep 24, 2018
1 parent 2a9fbef commit 5665592
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion client/src/components/CommentBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ class CommentBox extends Component {

render() {
const { rating, error, submitted } = this.state
const { ...otherProps } = this.props
// For after the user submits their comment
if (submitted) {
return <Text large className="fadein">Thanks for your opinion!</Text>
}

return(
<div>
<div {...otherProps}>
<Formik
initialValues = {commentBoxInitialValues}
onSubmit = {this.handleSubmit}
Expand Down
10 changes: 3 additions & 7 deletions client/src/scenes/Recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Recipe extends React.Component {
renderComments = () => {
const { comments } = this.props.recipe
return comments.map((comment, index) => (
<Comment comment={comment} />
<Comment comment={comment} key={index} />
))
}

Expand Down Expand Up @@ -151,19 +151,15 @@ class Recipe extends React.Component {
<Text medium semiBold>
Leave a Comment
</Text>
<CommentBox/>
<CommentBox style={{ marginBottom: 15 }}/>
{this.renderComments()}
</div>
{window.innerWidth < 992 && <hr />}
</div>
<div className="col-xs-12 col-lg-3">
<RecipeInformationCard recipe={recipe} />
</div>
</div>
<div className="row">
<div className="col-xs-12 col-lg-7 offset-lg-1">
{this.renderComments()}
</div>
</div>
{window.innerWidth < 768 &&
<ScrollToRecipeButton atBottom={atBottom}/>
}
Expand Down

0 comments on commit 5665592

Please sign in to comment.