File size: 1,060 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import CommentInput from './CommentInput';
import CommentList from './CommentList';
import { Link } from 'react-router-dom';
import React from 'react';
const CommentContainer = props => {
if (props.currentUser) {
return (
<div className="col-xs-12 col-md-8 offset-md-2">
<div>
<list-errors errors={props.errors}></list-errors>
<CommentInput slug={props.slug} currentUser={props.currentUser} />
</div>
<CommentList
comments={props.comments}
slug={props.slug}
currentUser={props.currentUser} />
</div>
);
} else {
return (
<div className="col-xs-12 col-md-8 offset-md-2">
<p>
<Link to="/login">Sign in</Link>
or
<Link to="/register">sign up</Link>
to add comments on this article.
</p>
<CommentList
comments={props.comments}
slug={props.slug}
currentUser={props.currentUser} />
</div>
);
}
};
export default CommentContainer;
|