@soul-refiner/design-system 0.2.71 → 0.2.72
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.
|
@@ -18,7 +18,7 @@ export const TextArea = ({ bg = 'var(--color-blue-10)', disabled, helperText, ic
|
|
|
18
18
|
icon,
|
|
19
19
|
React.createElement(TextAreaElement, { disabled: disabled, name: name, onChange: onChange, placeholder: placeholder, ref: ref, value: maxCharacters
|
|
20
20
|
? value.slice(0, maxCharacters - 1)
|
|
21
|
-
: value, "$resize": resize }),
|
|
21
|
+
: value, "$minHeight": minHeight, "$resize": resize }),
|
|
22
22
|
successful && React.createElement(CheckmarkCircle, { color: "green-3" }),
|
|
23
23
|
warning && React.createElement(AlertCircle, { color: "red-4" })),
|
|
24
24
|
React.createElement(Box, { "$gap": 16, "$justify": "space-between" },
|
|
@@ -75,6 +75,7 @@ const InputWrapper = styled.div `
|
|
|
75
75
|
${({ $warning }) => $warning ? 'border-color: var(--color-red-4) !important;' : ''}
|
|
76
76
|
`;
|
|
77
77
|
const TextAreaElement = styled.textarea `
|
|
78
|
+
min-width: ${({ $minHeight }) => ($minHeight ? $minHeight - 24 + 'px;' : '')}
|
|
78
79
|
padding: 0px;
|
|
79
80
|
flex: 1;
|
|
80
81
|
font-family: var(--font-inter);
|
|
@@ -7,8 +7,11 @@ export interface PostProps extends React.PropsWithChildren {
|
|
|
7
7
|
authorImage: string;
|
|
8
8
|
content: string;
|
|
9
9
|
createdDate: string;
|
|
10
|
+
dropdown?: React.ReactElement;
|
|
10
11
|
hasComments?: boolean;
|
|
11
12
|
id?: string;
|
|
12
13
|
images?: string[];
|
|
14
|
+
isPaywalled?: boolean;
|
|
15
|
+
onJoin?: () => void;
|
|
13
16
|
}
|
|
14
|
-
export declare const Post: ({ actions, author, authorActive, authorHref, authorImage,
|
|
17
|
+
export declare const Post: ({ actions, author, authorActive, authorHref, authorImage, content, createdDate, dropdown, id, images, isPaywalled, onJoin, }: PostProps) => React.JSX.Element;
|
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import {
|
|
4
|
+
import { H, P } from '../../atoms/typography';
|
|
5
|
+
import { Button } from '../../actions/button';
|
|
6
|
+
import { Avatar } from '../../iconography/avatar';
|
|
7
|
+
import { Lock } from '../../../icons';
|
|
5
8
|
import { abbrTimeBeforeDate } from './helpers';
|
|
6
|
-
export const Post = ({ actions, author, authorActive, authorHref, authorImage,
|
|
7
|
-
const
|
|
9
|
+
export const Post = ({ actions, author, authorActive, authorHref, authorImage, content, createdDate, dropdown, id, images, isPaywalled = false, onJoin, }) => {
|
|
10
|
+
const componentId = React.useId();
|
|
8
11
|
const _actions = React.Children.toArray(actions);
|
|
9
|
-
const _comments = React.Children.toArray(children);
|
|
10
12
|
const subtitle = abbrTimeBeforeDate(new Date(createdDate));
|
|
11
13
|
return (React.createElement(Wrapper, { id: id },
|
|
12
14
|
React.createElement(Header, null,
|
|
13
|
-
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" })
|
|
14
|
-
|
|
15
|
-
!!
|
|
16
|
-
|
|
15
|
+
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" }),
|
|
16
|
+
dropdown),
|
|
17
|
+
!!content?.length && (React.createElement("div", { style: { padding: 24 } },
|
|
18
|
+
React.createElement(P, { "$textClampLines": isPaywalled ? 2 : undefined }, content))),
|
|
19
|
+
!!images?.length && (React.createElement(ImagesWrapper, { "$numImages": images.length, "$isPaywalled": isPaywalled },
|
|
20
|
+
images.slice(0, 4).map((url, i) => (React.createElement(ImageWrapper, { key: `${componentId}${url.slice(0, 15)}${i}` },
|
|
17
21
|
React.createElement("img", { src: url, alt: "" })))),
|
|
18
22
|
images.length > 4 && (React.createElement(H, { as: "p", className: "more-than", "$color": "grey-10", "$fontSize": 28, "$lineHeight": 36, "$semiBold": true },
|
|
19
23
|
"+",
|
|
20
24
|
images.length - 4)))),
|
|
21
|
-
!!
|
|
22
|
-
|
|
25
|
+
!!images?.length && isPaywalled && (React.createElement(PaywallWrapper, null,
|
|
26
|
+
React.createElement(Lock, { size: 40, color: "grey-7" }),
|
|
27
|
+
React.createElement(P, { "$fontSize": 14, "$bold": true, "$lineHeight": 20, "$color": "white" },
|
|
28
|
+
"Become a member",
|
|
29
|
+
React.createElement("br", null),
|
|
30
|
+
"to unlock this post"),
|
|
31
|
+
React.createElement(Button, { onClick: onJoin, size: "small", sx: "width: 213px;", type: "outlined" }, "Join now"))),
|
|
32
|
+
!!_actions.length && (React.createElement(ActionsWrapper, null, !isPaywalled && _actions))));
|
|
23
33
|
};
|
|
24
34
|
const Wrapper = styled.div `
|
|
35
|
+
position: relative;
|
|
25
36
|
max-width: 700px;
|
|
26
37
|
width: 100%;
|
|
27
38
|
background-color: var(--color-white);
|
|
@@ -78,6 +89,13 @@ const ImagesWrapper = styled.div `
|
|
|
78
89
|
height: 100%;
|
|
79
90
|
}
|
|
80
91
|
`}
|
|
92
|
+
|
|
93
|
+
${({ $isPaywalled }) => $isPaywalled
|
|
94
|
+
? /** TODO REMOVE USER CAN CHANGE -> SECURITY */
|
|
95
|
+
`
|
|
96
|
+
filter: blur(10px) brightness(0.6);
|
|
97
|
+
clip-path: inset(0px 0px 0px 0px);`
|
|
98
|
+
: ''}
|
|
81
99
|
`;
|
|
82
100
|
const ImageWrapper = styled.div `
|
|
83
101
|
position: relative;
|
|
@@ -85,16 +103,18 @@ const ImageWrapper = styled.div `
|
|
|
85
103
|
flex: 1;
|
|
86
104
|
min-width: min(227px, 80vw);
|
|
87
105
|
`;
|
|
106
|
+
const PaywallWrapper = styled.div `
|
|
107
|
+
position: absolute;
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
gap: 16px;
|
|
111
|
+
align-items: center;
|
|
112
|
+
top: 310px;
|
|
113
|
+
left: 242px;
|
|
114
|
+
`;
|
|
88
115
|
const ActionsWrapper = styled.div `
|
|
89
116
|
display: flex;
|
|
90
117
|
justify-content: space-around;
|
|
91
118
|
align-items: center;
|
|
92
119
|
padding: 24px;
|
|
93
|
-
border-bottom: 1px solid var(--color-grey-9);
|
|
94
|
-
`;
|
|
95
|
-
const CommentWrapper = styled.div `
|
|
96
|
-
padding: 24px;
|
|
97
|
-
display: flex;
|
|
98
|
-
flex-flow: column nowrap;
|
|
99
|
-
gap: 24px;
|
|
100
120
|
`;
|