From e0f09caa3dbf22de6776e99430bbc2780bbd8687 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Fri, 3 Jun 2022 15:49:56 +0800 Subject: [PATCH] client: fix name case --- .../document/comments/comments/index.tsx | 2 +- .../comments/comments/item/index.module.scss | 25 ++++++ .../document/comments/comments/item/index.tsx | 89 +++++++++++++++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 packages/client/src/components/document/comments/comments/item/index.module.scss create mode 100644 packages/client/src/components/document/comments/comments/item/index.tsx diff --git a/packages/client/src/components/document/comments/comments/index.tsx b/packages/client/src/components/document/comments/comments/index.tsx index 608e268..3738ecb 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 0000000..f424248 --- /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 0000000..566f77a --- /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 ( + +
+ +
+
+
+ +
+
+
+ +
+
+
+ + } + >
+ ); +};