Skip to content

Commit 1bbecb8

Browse files
committed
Post comments update
1 parent 2b5b042 commit 1bbecb8

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

data/db.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@
108108
"body": "Comment 1",
109109
"postId": 1
110110
},
111+
{
112+
"id": 2,
113+
"body": "Comment 2",
114+
"postId": 1
115+
},
111116
{
112117
"id": 3,
113118
"body": "Comment 3",

src/components/postDetails.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@ export default function PostDetails() {
6060

6161
{post.comments.length > 0 &&
6262
<Fragment>
63-
<h3>Comments</h3>
63+
<h2>Comments</h2>
6464

6565
{post.comments.map((comment, index) => {
66-
return <p>{comment.body}</p>
66+
return (
67+
<div key={index} className="post-comments">
68+
<p>{comment.body}</p>
69+
</div>
70+
)
6771
})}
6872
</Fragment>
6973
}

src/components/postsList.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export default function PostsList(props) {
4242
Read More
4343
</Button>
4444
{post.comments.length > 0 &&
45-
<p className="card-comments">({post.comments.length}) Comment(s)</p>
45+
<div className="post-comments">
46+
<p>({post.comments.length}) Comment(s)</p>
47+
</div>
4648
}
4749
</div>
4850
</Card>

src/templates/Card.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from '@xstyled/styled-components'
33
const Card = styled.div`
44
background-color: secondaryColor !important;
55
border-radius: defaultRadius;
6+
border: none !important;
67
text-align: center;
78
margin: 0 0 15px 0;
89
@@ -44,8 +45,19 @@ const Card = styled.div`
4445
color: primaryColor;
4546
}
4647
47-
.card-comments {
48+
.post-comments {
4849
text-align: center;
50+
padding: 15px;
51+
border-bottom: 1px solid #dedede;
52+
53+
&:last-child {
54+
border: none;
55+
padding: 15px 15px 0 15px;
56+
}
57+
58+
p {
59+
text-align: center;
60+
}
4961
}
5062
}
5163
`

0 commit comments

Comments
 (0)