Compare commits
3 Commits
3e6ddab88d
...
52c8ab9eea
| Author | SHA1 | Date | |
|---|---|---|---|
| 52c8ab9eea | |||
| 475c490b16 | |||
| caf853e8a9 |
@@ -270,4 +270,8 @@ button {
|
|||||||
.logout {
|
.logout {
|
||||||
margin-left: 75%;
|
margin-left: 75%;
|
||||||
width: 25%
|
width: 25%
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: none;
|
||||||
}
|
}
|
||||||
@@ -32,10 +32,10 @@ const Post = ({ post, recursionDepth, selectPost, reload }) => {
|
|||||||
postApi.reactToPost(post.id, null).then(reload);
|
postApi.reactToPost(post.id, null).then(reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getComments = (post) => {
|
const getComments = (post, recursionDepth) => {
|
||||||
let nrOfComments = post.comments.length;
|
let nrOfComments = post.comments.length;
|
||||||
post.comments.forEach(comment => {
|
if (recursionDepth !== 0) post.comments.forEach(comment => {
|
||||||
nrOfComments += getComments(comment);
|
nrOfComments += getComments(comment, recursionDepth - 1);
|
||||||
})
|
})
|
||||||
return nrOfComments;
|
return nrOfComments;
|
||||||
}
|
}
|
||||||
@@ -51,10 +51,10 @@ const Post = ({ post, recursionDepth, selectPost, reload }) => {
|
|||||||
<p>{post.content}</p>
|
<p>{post.content}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="nrOfComments">
|
{recursionDepth !== 0 && <div className="nrOfComments">
|
||||||
<FontAwesomeIcon className="icon" icon={faComments}/>
|
<FontAwesomeIcon className="icon" icon={faComments}/>
|
||||||
<span className="">{getComments(post)}</span>
|
<span className="">{getComments(post, recursionDepth-1)}</span>
|
||||||
</div>
|
</div>}
|
||||||
<div className="post-right">
|
<div className="post-right">
|
||||||
<div className="post-date">
|
<div className="post-date">
|
||||||
{post.date.slice(8, 10) + "." + post.date.slice(5, 7) + "." + post.date.slice(0, 4)}
|
{post.date.slice(8, 10) + "." + post.date.slice(5, 7) + "." + post.date.slice(0, 4)}
|
||||||
|
|||||||
Reference in New Issue
Block a user