@soul-refiner/design-system 0.2.34 → 0.2.36
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.
- package/dist/components/atoms/typography/heading.d.ts +10 -9
- package/dist/components/atoms/typography/heading.js +10 -9
- package/dist/components/surfaces/comment/comment.d.ts +2 -1
- package/dist/components/surfaces/comment/comment.js +16 -6
- package/dist/components/surfaces/post/post.d.ts +1 -0
- package/dist/components/surfaces/post/post.js +1 -1
- package/package.json +1 -1
|
@@ -7,39 +7,40 @@ export interface HeadingProps extends CommonProps {
|
|
|
7
7
|
as?: React.ElementType;
|
|
8
8
|
$fontSize?: 16 | 18 | 20 | 24 | 28 | 32 | 36 | 40 | 48;
|
|
9
9
|
$lineHeight?: 64 | 60 | 54 | 48 | 36 | 28 | 26;
|
|
10
|
+
$sx?: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const H: {
|
|
12
|
-
(args: HeadingProps): React.JSX.Element;
|
|
13
|
+
({ sx, ...args }: HeadingProps): React.JSX.Element;
|
|
13
14
|
One: {
|
|
14
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
15
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
15
16
|
displayName: string;
|
|
16
17
|
};
|
|
17
18
|
Two: {
|
|
18
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
19
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
19
20
|
displayName: string;
|
|
20
21
|
};
|
|
21
22
|
Three: {
|
|
22
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
23
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
23
24
|
displayName: string;
|
|
24
25
|
};
|
|
25
26
|
Four: {
|
|
26
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
27
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
27
28
|
displayName: string;
|
|
28
29
|
};
|
|
29
30
|
Five: {
|
|
30
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
31
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
31
32
|
displayName: string;
|
|
32
33
|
};
|
|
33
34
|
Six: {
|
|
34
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
35
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
35
36
|
displayName: string;
|
|
36
37
|
};
|
|
37
38
|
Seven: {
|
|
38
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
39
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
39
40
|
displayName: string;
|
|
40
41
|
};
|
|
41
42
|
Eight: {
|
|
42
|
-
({ ...rest }: CommonProps): React.JSX.Element;
|
|
43
|
+
({ sx, ...rest }: CommonProps): React.JSX.Element;
|
|
43
44
|
displayName: string;
|
|
44
45
|
};
|
|
45
46
|
};
|
|
@@ -6,29 +6,30 @@ const StyledH = styled(Typography) `
|
|
|
6
6
|
font-size: ${({ $fontSize }) => $fontSize + 'px'};
|
|
7
7
|
line-height: ${({ $lineHeight }) => $lineHeight + 'px'};
|
|
8
8
|
text-align: ${({ $textAlign }) => $textAlign || 'left'};
|
|
9
|
+
${({ $sx }) => ($sx ? $sx : '')}
|
|
9
10
|
`;
|
|
10
|
-
export const H = (args) => React.createElement(StyledH, { ...args });
|
|
11
|
-
const One = ({ ...rest }) => (React.createElement(StyledH, { as: 'h1', "$fontSize": 48, "$lineHeight": 64, ...rest }));
|
|
11
|
+
export const H = ({ sx, ...args }) => (React.createElement(StyledH, { "$sx": sx, ...args }));
|
|
12
|
+
const One = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h1', "$fontSize": 48, "$lineHeight": 64, "$sx": sx, ...rest }));
|
|
12
13
|
One.displayName = 'H.One';
|
|
13
14
|
H.One = One;
|
|
14
|
-
const Two = ({ ...rest }) => (React.createElement(StyledH, { as: 'h2', "$fontSize": 40, "$lineHeight": 60, ...rest }));
|
|
15
|
+
const Two = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h2', "$fontSize": 40, "$lineHeight": 60, "$sx": sx, ...rest }));
|
|
15
16
|
Two.displayName = 'H.Two';
|
|
16
17
|
H.Two = Two;
|
|
17
|
-
const Three = ({ ...rest }) => (React.createElement(StyledH, { as: 'h3', "$fontSize": 36, "$lineHeight": 54, ...rest }));
|
|
18
|
+
const Three = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h3', "$fontSize": 36, "$lineHeight": 54, "$sx": sx, ...rest }));
|
|
18
19
|
Three.displayName = 'H.Three';
|
|
19
20
|
H.Three = Three;
|
|
20
|
-
const Four = ({ ...rest }) => (React.createElement(StyledH, { as: 'h4', "$fontSize": 32, "$lineHeight": 48, ...rest }));
|
|
21
|
+
const Four = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h4', "$fontSize": 32, "$lineHeight": 48, "$sx": sx, ...rest }));
|
|
21
22
|
Four.displayName = 'H.Four';
|
|
22
23
|
H.Four = Four;
|
|
23
|
-
const Five = ({ ...rest }) => (React.createElement(StyledH, { as: 'h5', "$fontSize": 28, "$lineHeight": 36, ...rest }));
|
|
24
|
+
const Five = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h5', "$fontSize": 28, "$lineHeight": 36, "$sx": sx, ...rest }));
|
|
24
25
|
Five.displayName = 'H.Five';
|
|
25
26
|
H.Five = Five;
|
|
26
|
-
const Six = ({ ...rest }) => (React.createElement(StyledH, { as: 'h6', "$fontSize": 24, "$lineHeight": 36, ...rest }));
|
|
27
|
+
const Six = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h6', "$fontSize": 24, "$lineHeight": 36, "$sx": sx, ...rest }));
|
|
27
28
|
Six.displayName = 'H.Six';
|
|
28
29
|
H.Six = Six;
|
|
29
|
-
const Seven = ({ ...rest }) => (React.createElement(StyledH, { as: 'h6', "$fontSize": 20, "$lineHeight": 28, ...rest }));
|
|
30
|
+
const Seven = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h6', "$fontSize": 20, "$lineHeight": 28, "$sx": sx, ...rest }));
|
|
30
31
|
Seven.displayName = 'H.Seven';
|
|
31
32
|
H.Seven = Seven;
|
|
32
|
-
const Eight = ({ ...rest }) => (React.createElement(StyledH, { as: 'h6', "$fontSize": 18, "$lineHeight": 26, ...rest }));
|
|
33
|
+
const Eight = ({ sx, ...rest }) => (React.createElement(StyledH, { as: 'h6', "$fontSize": 18, "$lineHeight": 26, "$sx": sx, ...rest }));
|
|
33
34
|
Eight.displayName = 'H.Eight';
|
|
34
35
|
H.Eight = Eight;
|
|
@@ -4,6 +4,7 @@ export interface CommentProps {
|
|
|
4
4
|
createdDate: Date;
|
|
5
5
|
onComment: (comment: string) => void;
|
|
6
6
|
onReact: (reaction: string) => void;
|
|
7
|
+
onShowReplies?: () => void;
|
|
7
8
|
reactions?: Record<string, number>;
|
|
8
9
|
replies?: CommentProps[];
|
|
9
10
|
userImageUri: string;
|
|
@@ -11,4 +12,4 @@ export interface CommentProps {
|
|
|
11
12
|
userReactions?: string[];
|
|
12
13
|
userProfileUri: string;
|
|
13
14
|
}
|
|
14
|
-
export declare const Comment: ({ content, createdDate, onComment, onReact, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }: CommentProps) => React.JSX.Element;
|
|
15
|
+
export declare const Comment: ({ content, createdDate, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }: CommentProps) => React.JSX.Element;
|
|
@@ -3,14 +3,16 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import Picker from '@emoji-mart/react';
|
|
5
5
|
import { Avatar, Box, P, TextInput } from '../../';
|
|
6
|
+
import { Button } from '../../actions/button';
|
|
6
7
|
import emojis from '../../../emoji/emojis.json';
|
|
7
8
|
import { ThumbsUp, Comment as CommentIcon } from '../../../icons';
|
|
8
9
|
import { abbrTimeBeforeDate } from './helpers';
|
|
9
10
|
import { Styles } from '../../../common';
|
|
10
|
-
export const Comment = ({ content, createdDate, onComment, onReact, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }) => {
|
|
11
|
+
export const Comment = ({ content, createdDate, onComment, onReact, onShowReplies, reactions, replies, userImageUri, userName, userReactions, userProfileUri, }) => {
|
|
11
12
|
const id = React.useId();
|
|
12
13
|
const [showPicker, setShowPicker] = React.useState(false);
|
|
13
|
-
const [
|
|
14
|
+
const [toggleShowCommentInput, setShowCommentInput] = React.useState(false);
|
|
15
|
+
const [toggleShowReplies, setShowReplies] = React.useState(false);
|
|
14
16
|
const [comment, setComment] = React.useState('');
|
|
15
17
|
const handleCommentChange = (event) => {
|
|
16
18
|
setComment(event.target.value);
|
|
@@ -30,7 +32,11 @@ export const Comment = ({ content, createdDate, onComment, onReact, reactions, r
|
|
|
30
32
|
setShowPicker((prev) => !prev);
|
|
31
33
|
};
|
|
32
34
|
const handlePickerBlur = () => setShowPicker(false);
|
|
33
|
-
const
|
|
35
|
+
const handleToggleCommentInput = () => setShowCommentInput((prev) => !prev);
|
|
36
|
+
const handleToggleReplies = () => {
|
|
37
|
+
onShowReplies && onShowReplies();
|
|
38
|
+
setShowReplies((prev) => !prev);
|
|
39
|
+
};
|
|
34
40
|
const createdTime = abbrTimeBeforeDate(createdDate);
|
|
35
41
|
const reactionElements = reactions &&
|
|
36
42
|
Object.entries(reactions)
|
|
@@ -52,14 +58,18 @@ export const Comment = ({ content, createdDate, onComment, onReact, reactions, r
|
|
|
52
58
|
React.createElement(P, { sx: "letter-spacing: -0.176px;" }, content)),
|
|
53
59
|
React.createElement(Box, { "$align": "flex-start", "$dir": "row", "$display": "flex", "$gap": 16, sx: "margin: 8px 0px; position: relative;" },
|
|
54
60
|
React.createElement(ThumbsUp, { color: "primary-blue-2", onClick: handlePicker, size: 24, sx: "border-radius: 50%; cursor: pointer; flex-shrink: 0;" }),
|
|
55
|
-
React.createElement(CommentIcon, { color: "primary-blue-2", onClick:
|
|
61
|
+
React.createElement(CommentIcon, { color: "primary-blue-2", onClick: handleToggleCommentInput, size: 24, sx: "border-radius: 50%; cursor: pointer; flex-shrink: 0;" }),
|
|
56
62
|
React.createElement(P, { "$color": "grey-7" }, "\u2022"),
|
|
57
63
|
React.createElement(P, { "$color": "grey-4", "$fontSize": 12, "$lineHeight": 24, sx: "flex-shrink: 0;" }, createdTime),
|
|
58
64
|
React.createElement(Box, { "$display": "flex", "$flow": "row wrap", "$gap": 6, sx: "max-width: calc(100% - 190px); margin-left: auto;" }, reactionElements),
|
|
59
65
|
showPicker && (React.createElement(PickerWrapper, null,
|
|
60
66
|
React.createElement(Picker, { data: emojis, onEmojiSelect: handleReaction, onClickOutside: handlePickerBlur, maxFrequentRows: 1, navPosition: "none", previewPosition: "none", perLine: 9, theme: "auto" }))))),
|
|
61
|
-
hasReplies && React.createElement(RepliesWrapper, null,
|
|
62
|
-
|
|
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
|
+
hasReplies && toggleShowReplies && (React.createElement(RepliesWrapper, null, replyElements)),
|
|
72
|
+
toggleShowCommentInput && (React.createElement(CommentWrapper, { onSubmit: handleCommentSubmit },
|
|
63
73
|
React.createElement(TextInput, { bg: "var(--color-grey-10)", placeholder: "Write a reply", onChange: handleCommentChange, value: comment }))))));
|
|
64
74
|
};
|
|
65
75
|
const Wrapper = styled.div `
|
|
@@ -18,7 +18,7 @@ export const Post = ({ actions, author, authorActive, authorHref, authorImage, c
|
|
|
18
18
|
setComment('');
|
|
19
19
|
};
|
|
20
20
|
const subtitle = abbrTimeBeforeDate(new Date(createdDate));
|
|
21
|
-
return (React.createElement(Wrapper,
|
|
21
|
+
return (React.createElement(Wrapper, { id: id },
|
|
22
22
|
React.createElement(Header, null,
|
|
23
23
|
React.createElement(Avatar, { href: authorHref, image: authorImage, size: 64, status: authorActive ? 'online' : undefined, subtitle: React.createElement(P, { as: "span", sx: "vertical-align: top;", "$fontSize": 14, "$lineHeight": 20 }, subtitle), title: React.createElement(H, { as: "span", "$bold": true, "$fontSize": 18, "$lineHeight": 26 }, author), textPosition: "right" })),
|
|
24
24
|
React.createElement(P, { "$sx": "padding: 24px;" }, content),
|