frontend: Voir et Poster des commentaires

This commit is contained in:
Divlo
2020-04-10 20:20:07 +02:00
parent 903590fb08
commit 39a332a867
13 changed files with 232 additions and 24 deletions

View File

@ -0,0 +1,33 @@
.CommentCard {
display: flex;
flex-direction: column;
word-wrap: break-word;
box-shadow: 0px 0px 6px 6px rgba(0, 0, 0, .25);
border: 1px solid black;
border-radius: .7em;
margin: 15px 0 15px 0;
}
.CommentCard__container {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
padding: 20px;
}
.CommentCard__user-logo {
border-radius: 50%;
object-fit: cover;
width: 50px;
height: 50px;
cursor: pointer;
}
.CommentCard__message-info {
display: flex;
align-items: center;
margin-left: 10px;
font-size: 16px;
}
.CommentCard__message {
line-height: 1.8;
margin: 15px 0 0 0;
}

View File

@ -0,0 +1,32 @@
import Link from 'next/link';
import { forwardRef } from 'react';
import { API_URL } from '../../utils/config';
import date from 'date-and-time';
import './CommentCard.css';
const CommentCard = forwardRef((props, ref) => {
return (
<div ref={ref} className="CommentCard col-24">
<div className="CommentCard__container">
<div className="row">
<Link href={"/profile/[name]"} as={`/profile/${props.user.name}`}>
<img className="CommentCard__user-logo" src={API_URL + props.user.logo} alt={props.user.name} />
</Link>
<span className="CommentCard__message-info">
<Link href={"/profile/[name]"} as={`/profile/${props.user.name}`}>
<a>{props.user.name}</a>
</Link>
&nbsp;- {date.format(new Date(props.createdAt), 'DD/MM/YYYY à HH:mm', true)}
</span>
</div>
<div className="row">
<p className="CommentCard__message">
{props.message}
</p>
</div>
</div>
</div>
);
});
export default CommentCard;