@soul-refiner/design-system 0.2.41 → 0.2.43
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,6 +3,7 @@ export interface CommentProps {
|
|
|
3
3
|
content: string;
|
|
4
4
|
createdDate: Date;
|
|
5
5
|
hasMoreReplies?: boolean;
|
|
6
|
+
id?: string;
|
|
6
7
|
onComment: (comment: string, id?: string) => void;
|
|
7
8
|
onReact: (reaction: string) => void;
|
|
8
9
|
onShowReplies?: () => void;
|
|
@@ -13,4 +14,4 @@ export interface CommentProps {
|
|
|
13
14
|
userReactions?: string[];
|
|
14
15
|
userProfileUri: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const Comment: ({ content, createdDate, hasMoreReplies, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }: CommentProps) => React.JSX.Element;
|
|
17
|
+
export declare const Comment: ({ content, createdDate, hasMoreReplies, id, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }: CommentProps) => React.JSX.Element;
|
|
@@ -8,8 +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, hasMoreReplies, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }) => {
|
|
12
|
-
const id = React.useId();
|
|
11
|
+
export const Comment = ({ content, createdDate, hasMoreReplies, id, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }) => {
|
|
13
12
|
const [showPicker, setShowPicker] = React.useState(false);
|
|
14
13
|
const [toggleShowCommentInput, setShowCommentInput] = React.useState(false);
|
|
15
14
|
const [toggleShowReplies, setShowReplies] = React.useState(false);
|
|
@@ -36,7 +35,7 @@ export const Comment = ({ content, createdDate, hasMoreReplies, onComment, onRea
|
|
|
36
35
|
const handleToggleCommentInput = () => setShowCommentInput((prev) => !prev);
|
|
37
36
|
const handleToggleReplies = () => {
|
|
38
37
|
onShowReplies && onShowReplies();
|
|
39
|
-
setShowReplies(
|
|
38
|
+
setShowReplies(true);
|
|
40
39
|
};
|
|
41
40
|
const createdTime = abbrTimeBeforeDate(createdDate);
|
|
42
41
|
const reactionElements = reactions &&
|
|
@@ -56,7 +55,7 @@ export const Comment = ({ content, createdDate, hasMoreReplies, onComment, onRea
|
|
|
56
55
|
reply,
|
|
57
56
|
React.createElement(ReplyIndicator, null)));
|
|
58
57
|
});
|
|
59
|
-
return (React.createElement(Wrapper,
|
|
58
|
+
return (React.createElement(Wrapper, { id: id },
|
|
60
59
|
React.createElement(Avatar, { href: userProfileUri, image: userImageUri, size: 32 }),
|
|
61
60
|
React.createElement(Box, { "$flex": 1, "$dir": "column" },
|
|
62
61
|
React.createElement(ContentWrapper, { "$hasReplies": hasReplies || !!hasMoreReplies },
|
|
@@ -161,6 +160,9 @@ const ReplyIndicator = styled.div `
|
|
|
161
160
|
border-right: none;
|
|
162
161
|
`;
|
|
163
162
|
const CommentWrapper = styled.form `
|
|
163
|
+
label {
|
|
164
|
+
margin-bottom: 16px;
|
|
165
|
+
}
|
|
164
166
|
label > div {
|
|
165
167
|
box-shadow: var(--elevation-6);
|
|
166
168
|
border-radius: 16px;
|