@soul-refiner/design-system 0.2.40 → 0.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@ export interface CommentProps {
|
|
|
3
3
|
content: string;
|
|
4
4
|
createdDate: Date;
|
|
5
5
|
hasMoreReplies?: boolean;
|
|
6
|
-
onComment: (comment: string) => void;
|
|
6
|
+
onComment: (comment: string, id?: string) => void;
|
|
7
7
|
onReact: (reaction: string) => void;
|
|
8
8
|
onShowReplies?: () => void;
|
|
9
9
|
reactions?: Record<string, number>;
|
|
@@ -36,7 +36,7 @@ export const Comment = ({ content, createdDate, hasMoreReplies, onComment, onRea
|
|
|
36
36
|
const handleToggleCommentInput = () => setShowCommentInput((prev) => !prev);
|
|
37
37
|
const handleToggleReplies = () => {
|
|
38
38
|
onShowReplies && onShowReplies();
|
|
39
|
-
setShowReplies((prev) =>
|
|
39
|
+
setShowReplies((prev) => true);
|
|
40
40
|
};
|
|
41
41
|
const createdTime = abbrTimeBeforeDate(createdDate);
|
|
42
42
|
const reactionElements = reactions &&
|
|
@@ -51,7 +51,8 @@ export const Comment = ({ content, createdDate, hasMoreReplies, onComment, onRea
|
|
|
51
51
|
if (!React.isValidElement(reply))
|
|
52
52
|
return null;
|
|
53
53
|
const key = reply.props?.id;
|
|
54
|
-
|
|
54
|
+
const hasLine = index !== _replies.length - 1 || hasMoreReplies;
|
|
55
|
+
return (React.createElement(ReplyWrapper, { "$hasLine": hasLine, key: key },
|
|
55
56
|
reply,
|
|
56
57
|
React.createElement(ReplyIndicator, null)));
|
|
57
58
|
});
|
|
@@ -71,14 +72,14 @@ export const Comment = ({ content, createdDate, hasMoreReplies, onComment, onRea
|
|
|
71
72
|
showPicker && (React.createElement(PickerWrapper, null,
|
|
72
73
|
React.createElement(Picker, { data: emojis, onEmojiSelect: handleReaction, onClickOutside: handlePickerBlur, maxFrequentRows: 1, navPosition: "none", previewPosition: "none", perLine: 9, theme: "auto" }))))),
|
|
73
74
|
hasReplies && toggleShowReplies && (React.createElement(RepliesWrapper, null, replyElements)),
|
|
74
|
-
hasMoreReplies
|
|
75
|
-
|
|
76
|
-
React.createElement(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
!toggleShowReplies && !hasMoreReplies && hasReplies && (React.createElement(RepliesWrapper, null,
|
|
76
|
+
React.createElement(ReplyWrapper, { "$hasLine": false },
|
|
77
|
+
React.createElement(Button, { onClick: handleToggleReplies, size: "small", sx: "color: var(--color-grey-3);", type: "text" }, "show replies"),
|
|
78
|
+
React.createElement(ReplyIndicator, null)))),
|
|
79
|
+
hasMoreReplies && (React.createElement(RepliesWrapper, null,
|
|
80
|
+
React.createElement(ReplyWrapper, { "$hasLine": false },
|
|
81
|
+
React.createElement(Button, { onClick: handleToggleReplies, size: "small", sx: "color: var(--color-grey-3);", type: "text" }, "show more replies"),
|
|
82
|
+
React.createElement(ReplyIndicator, null)))),
|
|
82
83
|
toggleShowCommentInput && (React.createElement(CommentWrapper, { onSubmit: handleCommentSubmit },
|
|
83
84
|
React.createElement(TextInput, { bg: "var(--color-grey-10)", placeholder: "Write a reply", onChange: handleCommentChange, value: comment }))))));
|
|
84
85
|
};
|
|
@@ -137,7 +138,7 @@ const RepliesWrapper = styled.div `
|
|
|
137
138
|
`;
|
|
138
139
|
const ReplyWrapper = styled.div `
|
|
139
140
|
position: relative;
|
|
140
|
-
${({ $
|
|
141
|
+
${({ $hasLine }) => $hasLine
|
|
141
142
|
? `
|
|
142
143
|
&::before {
|
|
143
144
|
content: "";
|
|
@@ -150,10 +151,10 @@ const ReplyWrapper = styled.div `
|
|
|
150
151
|
`;
|
|
151
152
|
const ReplyIndicator = styled.div `
|
|
152
153
|
position: absolute;
|
|
153
|
-
top:
|
|
154
|
+
top: -12px;
|
|
154
155
|
left: -28px;
|
|
155
156
|
width: 28px;
|
|
156
|
-
height:
|
|
157
|
+
height: 32px;
|
|
157
158
|
border-bottom-left-radius: 16px;
|
|
158
159
|
border: 2px solid var(--color-grey-9);
|
|
159
160
|
border-top: none;
|