@soul-refiner/design-system 0.2.40 → 0.2.42

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) => !prev);
39
+ setShowReplies(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
- return (React.createElement(ReplyWrapper, { "$isNotLastReply": index !== _replies.length - 1, key: key },
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
- (!toggleShowReplies && hasReplies && (React.createElement(RepliesWrapper, null,
76
- React.createElement(ReplyWrapper, { "$isNotLastReply": false },
77
- React.createElement(Button, { onClick: handleToggleReplies, size: "small", sx: "color: var(--color-grey-3);", type: "text" },
78
- "show ",
79
- replies && replies.length ? 'more' : '',
80
- " replies"),
81
- React.createElement(ReplyIndicator, null))))),
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
- ${({ $isNotLastReply }) => $isNotLastReply
141
+ ${({ $hasLine }) => $hasLine
141
142
  ? `
142
143
  &::before {
143
144
  content: "";
@@ -150,16 +151,19 @@ const ReplyWrapper = styled.div `
150
151
  `;
151
152
  const ReplyIndicator = styled.div `
152
153
  position: absolute;
153
- top: 0;
154
+ top: -12px;
154
155
  left: -28px;
155
156
  width: 28px;
156
- height: 16px;
157
+ height: 32px;
157
158
  border-bottom-left-radius: 16px;
158
159
  border: 2px solid var(--color-grey-9);
159
160
  border-top: none;
160
161
  border-right: none;
161
162
  `;
162
163
  const CommentWrapper = styled.form `
164
+ label {
165
+ margin-bottom: 16px;
166
+ }
163
167
  label > div {
164
168
  box-shadow: var(--elevation-6);
165
169
  border-radius: 16px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.40",
3
+ "version": "0.2.42",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {