Skip to content

Commit

Permalink
[Enhancement #51] Comment form and list UI change
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope authored and blcham committed Sep 30, 2021
1 parent cbfa66e commit 4651459
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/components/comment/CommentForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ const CommentForm = (props) => {
commentValue: commentValue
};
props.onSaveComment(comment);
console.log(comment)
setCommentValue('');
}
return (
<Form onSubmit={submitHandler}>
<Form onSubmit={submitHandler} className="comment-form">
<Form.Group className="mb-3" controlId="formBasicComment">
<Form.Label>Comments</Form.Label>
<Form.Control
Expand All @@ -52,7 +51,7 @@ const CommentForm = (props) => {
onChange={commentValueChangeHandler}
/>
</Form.Group>
<Button variant="primary" type="submit">
<Button className="comment-button" variant="primary" type="submit" >
Submit
</Button>
</Form>
Expand Down
5 changes: 2 additions & 3 deletions src/components/comment/CommentList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ const CommentList = (props) => {
return (
<>
{props.comments.map((comment) => (
<>
<div className="comment-list-items" key={comment.id}>
<CommentView
author={comment.author}
timestamp={comment.timestamp}
commentValue={comment.commentValue}
/>
<br/>
</>
</div>
))}
</>
)
Expand Down
10 changes: 5 additions & 5 deletions src/components/comment/CommentView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import TimeAgo from "javascript-time-ago";
import en from "javascript-time-ago/locale/en";

const CommentView = (props) => {
TimeAgo.addDefaultLocale(en);
TimeAgo.addLocale(en);
const time = new TimeAgo('en-US');
const timeAgo = time.format(props.timestamp)
const timeAgo = time.format(props.timestamp);

return (
<div className="comment-content">
<div className="row">
<span className="col-md-auto comment-author">{props.author}</span>
<span className="text-muted col-sm-auto timestamp">{timeAgo}</span>
<span className="col-auto comment-author">{props.author}</span>
<span className="col-auto text-muted comment-timestamp">{timeAgo}</span>
</div>
<div className="row">
<span className="comment-value col">{props.commentValue}</span>
<span className="col comment-value">{props.commentValue}</span>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/comment/QuestionCommentIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const QuestionCommentIcon = () => {

<Overlay target={target.current} show={show} placement="right" rootClose={true} onHide={hideOverlay}>
{(props) => (
<Tooltip id="comment-tooltip" {...props}>
<Tooltip className="comment-tooltip" {...props}>
<span>
<NewComment onAddComment={addCommentHandler}/>
<CommentList comments={comment}/>
Expand Down
15 changes: 12 additions & 3 deletions src/styles/s-forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,23 @@ input:disabled {
animation: emphasiseOnRelevantSection 1.2s ease-in;
}

.comment-content .comment-author {
font-weight: 700;
.comment-tooltip > .tooltip-inner {
max-width: none;
width: 30vw;
}

.comment-content .comment-value {
.comment-content {
text-align: left;
}

.comment-content .comment-author {
font-weight: 900;
}

.comment-list-items {
padding-top: 20px;
}

@keyframes emphasiseOnRelevant {
0% {
display: none;
Expand Down

0 comments on commit 4651459

Please sign in to comment.