@soul-refiner/design-system 0.2.37 → 0.2.39
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.
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export interface CommentProps {
|
|
3
3
|
content: string;
|
|
4
4
|
createdDate: Date;
|
|
5
|
+
hasMoreReplies?: boolean;
|
|
5
6
|
onComment: (comment: string) => void;
|
|
6
7
|
onReact: (reaction: string) => void;
|
|
7
8
|
onShowReplies?: () => void;
|
|
@@ -12,4 +13,4 @@ export interface CommentProps {
|
|
|
12
13
|
userReactions?: string[];
|
|
13
14
|
userProfileUri: string;
|
|
14
15
|
}
|
|
15
|
-
export declare const Comment: ({ content, createdDate, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }: CommentProps) => React.JSX.Element;
|
|
16
|
+
export declare const Comment: ({ content, createdDate, hasMoreReplies, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }: CommentProps) => React.JSX.Element;
|
|
@@ -8,7 +8,7 @@ import emojis from '../../../emoji/emojis.json';
|
|
|
8
8
|
import { ThumbsUp, Comment as CommentIcon } from '../../../icons';
|
|
9
9
|
import { abbrTimeBeforeDate } from './helpers';
|
|
10
10
|
import { Styles } from '../../../common';
|
|
11
|
-
export const Comment = ({ content, createdDate, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }) => {
|
|
11
|
+
export const Comment = ({ content, createdDate, hasMoreReplies, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }) => {
|
|
12
12
|
const id = React.useId();
|
|
13
13
|
const [showPicker, setShowPicker] = React.useState(false);
|
|
14
14
|
const [toggleShowCommentInput, setShowCommentInput] = React.useState(false);
|
|
@@ -52,7 +52,7 @@ export const Comment = ({ content, createdDate, onComment, onReact, onShowReplie
|
|
|
52
52
|
return (React.createElement(Wrapper, null,
|
|
53
53
|
React.createElement(Avatar, { href: userProfileUri, image: userImageUri, size: 32 }),
|
|
54
54
|
React.createElement(Box, { "$flex": 1, "$dir": "column" },
|
|
55
|
-
React.createElement(ContentWrapper, { "$hasReplies": hasReplies },
|
|
55
|
+
React.createElement(ContentWrapper, { "$hasReplies": hasReplies || !!hasMoreReplies },
|
|
56
56
|
React.createElement(CommentBox, null,
|
|
57
57
|
React.createElement(P, { "$bold": true, "$color": "grey-2", "$fontSize": 14, "$lineHeight": 20 }, userName),
|
|
58
58
|
React.createElement(P, { sx: "letter-spacing: -0.176px;" }, content)),
|
|
@@ -64,11 +64,15 @@ export const Comment = ({ content, createdDate, onComment, onReact, onShowReplie
|
|
|
64
64
|
React.createElement(Box, { "$display": "flex", "$flow": "row wrap", "$gap": 6, sx: "max-width: calc(100% - 190px); margin-left: auto;" }, reactionElements),
|
|
65
65
|
showPicker && (React.createElement(PickerWrapper, null,
|
|
66
66
|
React.createElement(Picker, { data: emojis, onEmojiSelect: handleReaction, onClickOutside: handlePickerBlur, maxFrequentRows: 1, navPosition: "none", previewPosition: "none", perLine: 9, theme: "auto" }))))),
|
|
67
|
-
hasReplies && !toggleShowReplies && (React.createElement(RepliesWrapper, null,
|
|
68
|
-
React.createElement(ReplyWrapper, { "$isNotLastReply": false },
|
|
69
|
-
React.createElement(Button, { onClick: handleToggleReplies, size: "small", sx: "color: var(--color-grey-3);", type: "text" }, "show replies"),
|
|
70
|
-
React.createElement(ReplyIndicator, null)))),
|
|
71
67
|
hasReplies && toggleShowReplies && (React.createElement(RepliesWrapper, null, replyElements)),
|
|
68
|
+
hasMoreReplies ||
|
|
69
|
+
(!toggleShowReplies && hasReplies && (React.createElement(RepliesWrapper, null,
|
|
70
|
+
React.createElement(ReplyWrapper, { "$isNotLastReply": false },
|
|
71
|
+
React.createElement(Button, { onClick: handleToggleReplies, size: "small", sx: "color: var(--color-grey-3);", type: "text" },
|
|
72
|
+
"show ",
|
|
73
|
+
replies && replies.length ? 'more' : '',
|
|
74
|
+
" replies"),
|
|
75
|
+
React.createElement(ReplyIndicator, null))))),
|
|
72
76
|
toggleShowCommentInput && (React.createElement(CommentWrapper, { onSubmit: handleCommentSubmit },
|
|
73
77
|
React.createElement(TextInput, { bg: "var(--color-grey-10)", placeholder: "Write a reply", onChange: handleCommentChange, value: comment }))))));
|
|
74
78
|
};
|