diff --git a/src/components/Comment.js b/src/components/Comment.js new file mode 100644 index 0000000..81ff49d --- /dev/null +++ b/src/components/Comment.js @@ -0,0 +1,37 @@ +import React from 'react'; +import Avatar from '@mui/material/Avatar'; +import "./comment.css"; +import propTypes from 'prop-types'; + +function Comment({userName, text, creationDate, imgUrl}) { + + const day = creationDate.getDate(); + const month = creationDate.getMonth() + 1; + const year = creationDate.getFullYear(); + const h = creationDate.getHours(); + const m = creationDate.getMinutes(); + + return ( + <> +
+ +
+
+

{userName}

+

{text}

+
+

{`${day}-${month}-${year} ${h}h ${m}min`}

+
+
+ + ); +} + +Comment.propTypes = { + userName: propTypes.string, + text: propTypes.string, + creationDate: propTypes.instanceOf(Date), + imgUrl: propTypes.string +} + +export default Comment; diff --git a/src/components/comment.css b/src/components/comment.css new file mode 100644 index 0000000..6c8af4e --- /dev/null +++ b/src/components/comment.css @@ -0,0 +1,25 @@ +.user { + font-weight: bold; +} + +.wrapper { + display: flex; + align-items: center; +} + +.text { + width: 250px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +p { + padding-left: 0.6rem; + margin-bottom: 0; + margin-top: 0; +} + +.date { + color: gray; +} diff --git a/src/images/dog.jpg b/src/images/dog.jpg new file mode 100644 index 0000000..6c36fd9 Binary files /dev/null and b/src/images/dog.jpg differ