diff --git a/src/components/Comment/Comment.tsx b/src/components/Comment/Comment.tsx new file mode 100644 index 00000000..e8df5865 --- /dev/null +++ b/src/components/Comment/Comment.tsx @@ -0,0 +1,89 @@ +import { PencilSquareIcon, TrashIcon } from '@heroicons/react/24/outline' +import Link from 'next/link' +import { Avatar } from '..' +import Button from '../common/Button/Button' + +export interface CommentProps { + commentId: string + user: { id: string; name: string; profile: string } + comment: string + date: Date + auth?: boolean + firstDepth?: boolean + replyCount?: number + onEdit?: (commentId: string) => void + onDelete?: (commentId: string) => void + onOpen?: (commentId: string) => void + onReply?: (commentId: string, userName: string) => void +} + +const Comment = ({ + commentId, + user, + comment, + date, + auth = false, + firstDepth = true, + replyCount = 0, + onEdit, + onDelete, + onOpen, + onReply, +}: CommentProps) => { + return ( +
+ +
+
+ + {user.name} + + {auth && onEdit && onDelete && ( +
+ + +
+ )} +
+

{comment}

+
+ {date.getFullYear().toString()}.{date.getMonth().toString()}. + {date.getDate().toString()} + {firstDepth && ( + <> + {' • '} + + {' • '} + + + )} +
+
+
+ ) +} + +export default Comment diff --git a/src/components/index.ts b/src/components/index.ts index 9209ce39..83af2a67 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -14,3 +14,4 @@ export { default as CategoryList } from './common/CategoryList/CategoryList' export { default as DropdownItem } from './common/Dropdown/DropdownItem' export { default as Dropdown } from './common/Dropdown/Dropdown' export { default as SpaceMemberList } from './common/SpaceMemberList/SpaceMemberList' +export { default as Comment } from './Comment/Comment'