diff --git a/packages/client/src/components/document/comments/comments/index.tsx b/packages/client/src/components/document/comments/comments/index.tsx index 608e2687..3738ecb5 100644 --- a/packages/client/src/components/document/comments/comments/index.tsx +++ b/packages/client/src/components/document/comments/comments/index.tsx @@ -1,7 +1,7 @@ import type { IComment } from '@think/domains'; import React from 'react'; -import { CommentItem } from './Item'; +import { CommentItem } from './item'; interface IProps { comments: Array; diff --git a/packages/client/src/components/document/comments/comments/item/index.module.scss b/packages/client/src/components/document/comments/comments/item/index.module.scss new file mode 100644 index 00000000..f424248f --- /dev/null +++ b/packages/client/src/components/document/comments/comments/item/index.module.scss @@ -0,0 +1,25 @@ +.wrap { + display: flex; + padding: 9px 0; + + + .wrap { + margin-top: 16px; + } + + .rightWrap { + flex: 1; + margin-left: 16px; + overflow: auto; + + > main { + margin: 10px 0; + color: var(--semi-color-text-0); + } + + > footer { + span { + cursor: pointer; + } + } + } +} diff --git a/packages/client/src/components/document/comments/comments/item/index.tsx b/packages/client/src/components/document/comments/comments/item/index.tsx new file mode 100644 index 00000000..566f77a1 --- /dev/null +++ b/packages/client/src/components/document/comments/comments/item/index.tsx @@ -0,0 +1,89 @@ +import { IconUser } from '@douyinfe/semi-icons'; +import { Avatar, Popconfirm, Skeleton, Space, Typography } from '@douyinfe/semi-ui'; +import type { IComment, IUser } from '@think/domains'; +import { LocaleTime } from 'components/locale-time'; +import { useUser } from 'data/user'; +import React from 'react'; + +import styles from './index.module.scss'; + +interface IProps { + comment: IComment; + replyComment: (comment: IComment) => void; + editComment: (comment: IComment) => void; + deleteComment: (comment: IComment) => void; +} + +const { Text } = Typography; + +export const CommentItem: React.FC = ({ comment, replyComment, editComment, deleteComment }) => { + const { user } = useUser(); + const { createUser = {} } = comment; + + if (!comment) return null; + + return ( +
+
+ + + +
+
+
+ + {(createUser as IUser).name} + + + + +
+
+
+
+
+ + replyComment(comment)}> + 回复 + + {user && user.id === comment.createUserId && ( + editComment(comment)}> + 编辑 + + )} + deleteComment(comment)}> + + 删除 + + + +
+
+
+ ); +}; + +export const CommentItemPlaceholder = () => { + return ( + +
+ +
+
+
+ +
+
+
+ +
+
+
+ + } + >
+ ); +};