@soul-refiner/design-system 0.2.32 → 0.2.34
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.
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface PostProps extends React.PropsWithChildren {
|
|
3
|
+
actions?: React.ReactNode;
|
|
3
4
|
author: string;
|
|
4
5
|
authorActive?: boolean;
|
|
5
6
|
authorHref: string;
|
|
6
7
|
authorImage: string;
|
|
7
8
|
content: string;
|
|
8
9
|
createdDate: string;
|
|
10
|
+
hasComments?: boolean;
|
|
9
11
|
images?: string[];
|
|
10
12
|
onComment: (comment: string) => void;
|
|
11
13
|
}
|
|
12
|
-
export declare const Post: ({ author, authorActive, authorHref, authorImage, children, content, createdDate, images, onComment, }: PostProps) => React.JSX.Element;
|
|
14
|
+
export declare const Post: ({ actions, author, authorActive, authorHref, authorImage, children, content, createdDate, hasComments, images, onComment, }: PostProps) => React.JSX.Element;
|
|
@@ -3,9 +3,10 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { Avatar, H, P, TextInput } from '../../';
|
|
5
5
|
import { abbrTimeBeforeDate } from './helpers';
|
|
6
|
-
export const Post = ({ author, authorActive, authorHref, authorImage, children, content, createdDate, images, onComment, }) => {
|
|
6
|
+
export const Post = ({ actions, author, authorActive, authorHref, authorImage, children, content, createdDate, hasComments, images, onComment, }) => {
|
|
7
7
|
const id = React.useId();
|
|
8
8
|
const [comment, setComment] = React.useState('');
|
|
9
|
+
const _actions = React.Children.toArray(actions);
|
|
9
10
|
const _comments = React.Children.toArray(children);
|
|
10
11
|
const handleCommentChange = (event) => {
|
|
11
12
|
setComment(event.target.value);
|
|
@@ -27,10 +28,11 @@ export const Post = ({ author, authorActive, authorHref, authorImage, children,
|
|
|
27
28
|
images.length > 4 && (React.createElement(H, { as: "p", className: "more-than", "$color": "grey-10", "$fontSize": 28, "$lineHeight": 36, "$semiBold": true },
|
|
28
29
|
"+",
|
|
29
30
|
images.length - 4)))),
|
|
30
|
-
!!_comments.length && React.createElement(CommentWrapper, null,
|
|
31
|
-
React.createElement(
|
|
31
|
+
hasComments && !!_comments.length && (React.createElement(CommentWrapper, null, _comments)),
|
|
32
|
+
!!_actions.length && React.createElement(ActionsWrapper, null, _actions),
|
|
33
|
+
hasComments && (React.createElement(CommentInputWrapper, { onSubmit: handleCommentSubmit },
|
|
32
34
|
React.createElement(Avatar, { href: authorHref, image: authorImage, size: 40 }),
|
|
33
|
-
React.createElement(TextInput, { bg: "var(--color-grey-10)", placeholder: "Write a comment", onChange: handleCommentChange, value: comment }))));
|
|
35
|
+
React.createElement(TextInput, { bg: "var(--color-grey-10)", placeholder: "Write a comment", onChange: handleCommentChange, value: comment })))));
|
|
34
36
|
};
|
|
35
37
|
const Wrapper = styled.div `
|
|
36
38
|
max-width: 700px;
|
|
@@ -96,6 +98,13 @@ const ImageWrapper = styled.div `
|
|
|
96
98
|
flex: 1;
|
|
97
99
|
min-width: min(227px, 80vw);
|
|
98
100
|
`;
|
|
101
|
+
const ActionsWrapper = styled.div `
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: space-around;
|
|
104
|
+
align-items: center;
|
|
105
|
+
padding: 24px;
|
|
106
|
+
border-bottom: 1px solid var(--color-grey-9);
|
|
107
|
+
`;
|
|
99
108
|
const CommentWrapper = styled.div `
|
|
100
109
|
padding: 24px;
|
|
101
110
|
display: flex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soul-refiner/design-system",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@storybook/addon-essentials": "^7.
|
|
28
|
-
"@storybook/addon-interactions": "^7.
|
|
29
|
-
"@storybook/addon-links": "^7.
|
|
30
|
-
"@storybook/addons": "^7.
|
|
31
|
-
"@storybook/blocks": "^7.
|
|
32
|
-
"@storybook/react": "^7.
|
|
33
|
-
"@storybook/react-vite": "^7.
|
|
34
|
-
"@storybook/testing-library": "^0.0
|
|
27
|
+
"@storybook/addon-essentials": "^7.2.1",
|
|
28
|
+
"@storybook/addon-interactions": "^7.2.1",
|
|
29
|
+
"@storybook/addon-links": "^7.2.1",
|
|
30
|
+
"@storybook/addons": "^7.2.1",
|
|
31
|
+
"@storybook/blocks": "^7.2.1",
|
|
32
|
+
"@storybook/react": "^7.2.1",
|
|
33
|
+
"@storybook/react-vite": "^7.2.1",
|
|
34
|
+
"@storybook/testing-library": "^0.2.0",
|
|
35
35
|
"@types/styled-components": "^5.1.26",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
37
37
|
"@typescript-eslint/parser": "^5.59.5",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"prettier": "^2.8.8",
|
|
43
43
|
"pretty-quick": "^3.1.3",
|
|
44
44
|
"prop-types": "^15.8.1",
|
|
45
|
-
"storybook": "^7.
|
|
45
|
+
"storybook": "^7.2.1",
|
|
46
46
|
"tsconfig-paths-webpack-plugin": "^4.0.1",
|
|
47
47
|
"typescript": "^5.0.4",
|
|
48
48
|
"vite": "^4.3.5",
|