display date of posts and comments
This commit is contained in:
@@ -25,7 +25,6 @@ const App = () => {
|
||||
if(selectedPost) {
|
||||
setSelectedPost(posts.find(post => post.id === selectedPost.id));
|
||||
}
|
||||
console.log(posts);
|
||||
}, [posts]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
20
src/App.scss
20
src/App.scss
@@ -55,7 +55,7 @@ h3 {
|
||||
align-items: flex-start;
|
||||
border: 1px solid #ddd;
|
||||
margin: 10px 0;
|
||||
padding: 15px;
|
||||
padding: 5px 5px 15px 15px;
|
||||
border-radius: 10px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
@@ -65,6 +65,22 @@ h3 {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.post-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
|
||||
.post-date {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
|
||||
.votes {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -89,6 +105,8 @@ h3 {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comment-form {
|
||||
display: flex;
|
||||
|
||||
@@ -13,6 +13,11 @@ const PostComment = ({ post, vote, type }) => {
|
||||
<p>{post.content}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="post-right">
|
||||
<div className="post-date">
|
||||
{post.date.slice(8, 10) + "." + post.date.slice(5, 7) + "." + post.date.slice(0, 4)}
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="votes">
|
||||
<button onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
@@ -29,6 +34,8 @@ const PostComment = ({ post, vote, type }) => {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user