@soul-refiner/design-system 0.1.17 → 0.1.19

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.
@@ -0,0 +1,248 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box, Button, Modal } from 'components';
4
+ import { Camera, Checkmark, Close, Pencil } from 'icons';
5
+
6
+ export interface FeatureCardProps {
7
+ content: string;
8
+ editable?: boolean;
9
+ href?: string;
10
+ image: string;
11
+ onSave?: (title: string, content: string) => void;
12
+ sx?: string;
13
+ title: string;
14
+ uploadModal?: React.ReactElement;
15
+ }
16
+
17
+ export const FeatureCard = ({
18
+ content = '',
19
+ editable,
20
+ href,
21
+ image,
22
+ onSave,
23
+ sx,
24
+ title = '',
25
+ uploadModal,
26
+ }: FeatureCardProps) => {
27
+ const [editing, setEditing] = React.useState(false);
28
+ const [editingTitle, setTitle] = React.useState(() => title);
29
+ const [editingContent, setContent] = React.useState(() => content);
30
+
31
+ const handleSetEditing = () => setEditing(true);
32
+
33
+ const handleCancelEdit = () => {
34
+ setTitle(title);
35
+ setContent(content);
36
+ setEditing(false);
37
+ };
38
+
39
+ const handleSave = () => {
40
+ setEditing(false);
41
+ onSave && onSave(editingTitle, editingContent);
42
+ };
43
+
44
+ const handleTitleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
45
+ setTitle(event.target.value);
46
+ };
47
+
48
+ const handleContentChange = (event: React.ChangeEvent<HTMLInputElement>) => {
49
+ setContent(event.target.value);
50
+ };
51
+
52
+ const showEditIcon = !editing && editable;
53
+ const isLink = !!href;
54
+
55
+ return (
56
+ <Wrapper as={isLink ? 'div' : 'a'} href={href}>
57
+ <Figure $editing={editing} $isLink={isLink} $sx={sx}>
58
+ <img alt={title} src={image} />
59
+ {!editing && (
60
+ <Title>
61
+ {editingTitle}
62
+ <figure>
63
+ <Content>{editingContent}</Content>
64
+ </figure>
65
+ {showEditIcon && (
66
+ <Pencil className="edit" onClick={handleSetEditing} />
67
+ )}
68
+ {editable && uploadModal && (
69
+ <Modal>
70
+ <Modal.Trigger>
71
+ <Button
72
+ icon={<Camera />}
73
+ type="outlined"
74
+ size="small"
75
+ sx="position: absolute; right: 8px; top: -72px;"
76
+ >
77
+ Edit
78
+ </Button>
79
+ </Modal.Trigger>
80
+ <Modal.Content>{uploadModal}</Modal.Content>
81
+ </Modal>
82
+ )}
83
+ </Title>
84
+ )}
85
+ {editing && (
86
+ <Box
87
+ $align="flex-end"
88
+ $display="flex"
89
+ $dir="column"
90
+ $gap={8}
91
+ sx="position: relative;"
92
+ >
93
+ <EditTitle onChange={handleTitleChange} value={editingTitle} />
94
+ <EditContent
95
+ onChange={handleContentChange}
96
+ value={editingContent}
97
+ />
98
+ <Box $gap={8}>
99
+ <Checkmark
100
+ onClick={handleSave}
101
+ sx={`
102
+ padding: 8px;
103
+ border-radius: 4px;
104
+ cursor: pointer;
105
+ background-color: var(--color-white);
106
+ box-shadow: var(--elevation-1);
107
+ &:hover {
108
+ background-color: var(--color-grey-10);
109
+ }
110
+ `}
111
+ />
112
+ <Close
113
+ onClick={handleCancelEdit}
114
+ sx={`
115
+ padding: 8px;
116
+ border-radius: 4px;
117
+ cursor: pointer;
118
+ background-color: var(--color-white);
119
+ box-shadow: var(--elevation-1);
120
+ &:hover {
121
+ background-color: var(--color-grey-10);
122
+ }
123
+ `}
124
+ />
125
+ </Box>
126
+ </Box>
127
+ )}
128
+ </Figure>
129
+ </Wrapper>
130
+ );
131
+ };
132
+
133
+ const Wrapper = styled.div`
134
+ text-decoration: none;
135
+ `;
136
+
137
+ const Figure = styled.figure<{
138
+ $editing: boolean;
139
+ $isLink: boolean;
140
+ $sx?: string;
141
+ }>`
142
+ max-width: 352px;
143
+ display: flex;
144
+ flex-flow: column nowrap;
145
+ gap: 16px;
146
+ padding: 16px;
147
+ margin: 0px;
148
+ border-radius: 16px;
149
+ box-shadow: var(--elevation-1);
150
+ border: 1px solid var(--color-white);
151
+
152
+ &:hover {
153
+ ${({ $isLink }) =>
154
+ $isLink
155
+ ? 'border: 1px solid var(--color-primary-blue-3); cursor: pointer;'
156
+ : 'cursor: arrow;'}
157
+
158
+ button {
159
+ display: flex;
160
+ }
161
+
162
+ .edit {
163
+ display: block;
164
+ }
165
+ }
166
+
167
+ img {
168
+ max-width: 352px;
169
+ aspect-ratio: 1/1;
170
+ }
171
+
172
+ figure {
173
+ display: flex;
174
+ flex-flow: column nowrap;
175
+ gap: 4px;
176
+ margin: 0px;
177
+ padding: 0px;
178
+ }
179
+
180
+ button {
181
+ display: none;
182
+ }
183
+
184
+ .edit {
185
+ position: absolute;
186
+ right: 0px;
187
+ top: 0px;
188
+ display: none;
189
+ padding: 8px;
190
+ border-radius: 50%;
191
+ cursor: pointer;
192
+ &:hover {
193
+ background-color: var(--color-grey-10);
194
+ }
195
+ }
196
+
197
+ ${({ $editing }) =>
198
+ $editing
199
+ ? `
200
+ background-color: var(--color-grey-9);`
201
+ : `
202
+ background-color: var(--color-white);`}
203
+
204
+ ${({ $sx }) => ($sx ? $sx : '')};
205
+ `;
206
+
207
+ const Title = styled.figcaption`
208
+ position: relative;
209
+ padding-right: 32px;
210
+ color: var(--color-grey-2);
211
+ font-size: 18px;
212
+ font-family: Inter;
213
+ font-weight: 500;
214
+ line-height: 26px;
215
+ letter-spacing: -0.252px;
216
+ user-select: none;
217
+ `;
218
+
219
+ const Content = styled.figcaption`
220
+ font-size: 14px;
221
+ font-family: Inter;
222
+ font-weight: 400;
223
+ line-height: 20px;
224
+ letter-spacing: -0.084px;
225
+ `;
226
+
227
+ const EditTitle = styled.input`
228
+ width: calc(100% - 24px);
229
+ padding: 12px;
230
+ background-color: var(--color-white);
231
+ font-size: 18px;
232
+ font-family: Inter;
233
+ font-weight: 500;
234
+ line-height: 26px;
235
+ letter-spacing: -0.252px;
236
+ border: none;
237
+ border-radius: 8px;
238
+ outline: none;
239
+ `;
240
+
241
+ const EditContent = styled(EditTitle)`
242
+ padding: 6px 12px;
243
+ font-size: 14px;
244
+ font-family: Inter;
245
+ font-weight: 400;
246
+ line-height: 20px;
247
+ letter-spacing: -0.084px;
248
+ `;
@@ -0,0 +1,2 @@
1
+ export { FeatureCard } from './feature';
2
+ export type { FeatureCardProps } from './feature';
@@ -0,0 +1,2 @@
1
+ export { Card } from './card';
2
+ export type { CardProps } from './card';
@@ -0,0 +1,2 @@
1
+ export { PersonCard } from './person';
2
+ export type { PersonCardProps } from './person';
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box, H, P } from 'components';
4
+
5
+ export interface PersonCardProps {
6
+ actions?: React.ReactElement | React.ReactElement[];
7
+ href: string;
8
+ image: string;
9
+ subtitle: string;
10
+ sx?: string;
11
+ title: string;
12
+ }
13
+
14
+ export const PersonCard = ({
15
+ actions,
16
+ href,
17
+ image,
18
+ subtitle,
19
+ sx,
20
+ title,
21
+ }: PersonCardProps) => {
22
+ return (
23
+ <Wrapper $image={image} as={href ? 'a' : 'div'}>
24
+ <Person $sx={sx}>
25
+ <Shadow>
26
+ <img src={image} alt="" />
27
+ </Shadow>
28
+ <Figcaption>
29
+ <H as="span" $bold $color="white" $fontSize={24} $lineHeight={36}>
30
+ {title}
31
+ </H>
32
+ <P as="span" $color="white" $fontSize={14} $lineHeight={20}>
33
+ {subtitle}
34
+ </P>
35
+ {actions && (
36
+ <Box $display="flex" $dir="row" $gap={8} sx="margin-top: 16px;">
37
+ {React.Children.toArray(actions)}
38
+ </Box>
39
+ )}
40
+ </Figcaption>
41
+ </Person>
42
+ </Wrapper>
43
+ );
44
+ };
45
+
46
+ const Wrapper = styled.div<{
47
+ $image: string;
48
+ }>`
49
+ width: 312px;
50
+ height: 400px;
51
+ display: block;
52
+ text-decoration: none;
53
+ cursor: pointer;
54
+
55
+ img {
56
+ width: 100%;
57
+ height: 100%;
58
+ border-radius: 16px;
59
+ }
60
+ `;
61
+
62
+ const Shadow = styled.div`
63
+ border-radius: 16px;
64
+ position: absolute;
65
+ top: 0px;
66
+ left: 0px;
67
+ right: 0px;
68
+ width: 100%;
69
+ height: 100%;
70
+ background: linear-gradient(180deg, rgba(0, 0, 0, 0) 66.67%, #000 98.25%),
71
+ transparent 50% / cover no-repeat;
72
+ `;
73
+
74
+ const Person = styled.figure<{
75
+ $sx?: string;
76
+ }>`
77
+ position: relative;
78
+ width: 100%;
79
+ height: 100%;
80
+ margin: 0px;
81
+ border-radius: 16px;
82
+ display: flex;
83
+ justify-content: flex-end;
84
+ flex-direction: column;
85
+
86
+ ${({ $sx }) => ($sx ? $sx : '')};
87
+ `;
88
+
89
+ const Figcaption = styled.figcaption`
90
+ position: relative;
91
+ width: 100%;
92
+ box-sizing: border-box;
93
+ display: flex;
94
+ flex-direction: column;
95
+ padding: 16px 24px;
96
+ `;
@@ -0,0 +1,2 @@
1
+ export { PriceCard } from './price';
2
+ export type { PriceCardProps } from './price';
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box, H, P } from 'components';
4
+ import { Checkmark } from 'icons';
5
+
6
+ export interface PriceCardProps {
7
+ actions: React.ReactElement;
8
+ content: string;
9
+ features: string[];
10
+ featureTitle: string;
11
+ price: string;
12
+ title: string;
13
+ }
14
+
15
+ export const PriceCard = ({
16
+ actions,
17
+ content,
18
+ featureTitle,
19
+ features,
20
+ price,
21
+ title,
22
+ }: PriceCardProps) => {
23
+ const id = React.useId();
24
+ return (
25
+ <Price>
26
+ <Box
27
+ $align="stretch"
28
+ $display="flex"
29
+ $dir="column"
30
+ $gap={24}
31
+ sx={`
32
+ padding: 24px 48px;
33
+ background-color: var(--color-grey-10);
34
+ border-radius: 16px 16px 0px 0px;
35
+ `}
36
+ >
37
+ <H
38
+ as="h6"
39
+ $fontSize={24}
40
+ $lineHeight={36}
41
+ $semiBold
42
+ $textAlign="center"
43
+ >
44
+ {title}
45
+ </H>
46
+ <Box $dir="column">
47
+ <H
48
+ as="p"
49
+ $bold
50
+ $fontSize={32}
51
+ $lineHeight={48}
52
+ $textClampLines={5}
53
+ $textAlign="center"
54
+ >
55
+ {price}
56
+ </H>
57
+ <P as="span" $color="grey-4" $textAlign="center">
58
+ /month
59
+ </P>
60
+ </Box>
61
+ {actions}
62
+ </Box>
63
+ <Box
64
+ sx="padding: 16px 24px; position: relative;"
65
+ $display="flex"
66
+ $dir="column"
67
+ >
68
+ <P sx="padding: 16px 0px;">{content}</P>
69
+ <Divider />
70
+ <Box sx="padding: 16px 0px;" $dir="column" $gap={8}>
71
+ <P $color="grey-2" $mediumBold>
72
+ {featureTitle}
73
+ </P>
74
+ {features.map((item, index) => (
75
+ <Box key={id + index.toString(36)} $align="center" $gap={12}>
76
+ <Checkmark
77
+ color="green-5"
78
+ sx="padding: 2px; border-radius: 50%; background-color: var(--color-green-9);"
79
+ />
80
+ <P $fontSize={14} $lineHeight={20}>
81
+ {item}
82
+ </P>
83
+ </Box>
84
+ ))}
85
+ </Box>
86
+ </Box>
87
+ </Price>
88
+ );
89
+ };
90
+
91
+ const Price = styled.figure`
92
+ margin: 0px;
93
+ padding: 0px;
94
+ width: 280px;
95
+ height: fit-content;
96
+ border-radius: 16px;
97
+ box-shadow: var(--elevation-2);
98
+ user-select: none;
99
+
100
+ &:hover {
101
+ border: 1px solid var(--color-primary-blue-3);
102
+ }
103
+ `;
104
+
105
+ const Divider = styled.div`
106
+ height: 1px;
107
+ width: 100%;
108
+ box-sizing: border-box;
109
+ background-color: var(--color-grey-9);
110
+ `;
@@ -0,0 +1,2 @@
1
+ export { RegularCard } from './regular';
2
+ export type { RegularCardProps } from './regular';
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box } from 'components';
4
+
5
+ export interface RegularCardProps extends React.PropsWithChildren {
6
+ href?: string;
7
+ image: string;
8
+ sx?: string;
9
+ }
10
+
11
+ export const RegularCard = ({
12
+ children,
13
+ href,
14
+ image,
15
+ sx,
16
+ }: RegularCardProps) => {
17
+ return (
18
+ <Wrapper $isLink={!!href} $sx={sx} as={href ? 'a' : 'div'} href={href}>
19
+ <img src={image} alt="" />
20
+ <Box $dir="column" $padding={24}>
21
+ {children}
22
+ </Box>
23
+ </Wrapper>
24
+ );
25
+ };
26
+
27
+ const Wrapper = styled.div<{
28
+ $isLink: boolean;
29
+ $sx?: string;
30
+ }>`
31
+ position: relative;
32
+ display: block;
33
+ text-decoration: none;
34
+ cursor: pointer;
35
+ box-shadow: var(--elevation-1);
36
+ border-radius: 16px;
37
+ background-color: var(--color-white);
38
+
39
+ ${({ $isLink }) =>
40
+ $isLink
41
+ ? `
42
+ &:hover {
43
+ border: 1px solid var(--color-primary-blue-3);
44
+ }`
45
+ : ''}
46
+
47
+ img {
48
+ border-radius: 16px 16px 0px 0px;
49
+ }
50
+
51
+ ${({ $sx }) => ($sx ? $sx : '')};
52
+ `;
@@ -0,0 +1,2 @@
1
+ export { VideoEpisodeCard } from './video';
2
+ export type { VideoEpisodeCardProps } from './video';
@@ -0,0 +1,167 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box, H, P, Rate } from 'components';
4
+
5
+ export interface VideoEpisodeCardProps {
6
+ actions: React.ReactElement[];
7
+ actionDropdown?: React.ReactElement;
8
+ content: string;
9
+ cta: React.ReactElement;
10
+ href: string;
11
+ image: string;
12
+ logo?: React.ReactElement;
13
+ numRating: number;
14
+ rating: number;
15
+ subtitle: string;
16
+ supportLabel?: string;
17
+ sx?: string;
18
+ title: string;
19
+ }
20
+
21
+ export const VideoEpisodeCard = ({
22
+ actions,
23
+ actionDropdown,
24
+ content,
25
+ cta,
26
+ href,
27
+ image,
28
+ logo,
29
+ numRating,
30
+ rating,
31
+ subtitle,
32
+ supportLabel,
33
+ sx,
34
+ title,
35
+ }: VideoEpisodeCardProps) => {
36
+ const hasLogo = !!logo;
37
+
38
+ return (
39
+ <Wrapper $sx={sx} href={href}>
40
+ <Figure>
41
+ {actionDropdown && <DropdownWrapper>{actionDropdown}</DropdownWrapper>}
42
+ <img className="thumbnail" src={image} alt="" />
43
+ <Figcaption>
44
+ <Box $display="block" className="hidden">
45
+ {cta}
46
+ </Box>
47
+ <Box $align="center" $dir="row" $gap={16}>
48
+ {logo}
49
+ <Box $dir="column">
50
+ <H $color="grey-2" $semiBold $fontSize={hasLogo ? 18 : 16}>
51
+ {title}
52
+ </H>
53
+ <P $color="grey-4" $fontSize={12} $lineHeight={16}>
54
+ {subtitle}
55
+ </P>
56
+ </Box>
57
+ {supportLabel && (
58
+ <P
59
+ className="not-hover"
60
+ $color="grey-4"
61
+ $fontSize={12}
62
+ $lineHeight={16}
63
+ sx="margin-left: auto; align-self: flex-end; margin-bottom: 2.5px;"
64
+ >
65
+ {supportLabel}
66
+ </P>
67
+ )}
68
+ </Box>
69
+ <P
70
+ $color="grey-5"
71
+ $fontSize={14}
72
+ $lineHeight={20}
73
+ $mediumBold
74
+ $textClampLines={4}
75
+ className="hidden"
76
+ >
77
+ {content}
78
+ </P>
79
+ <Box className="hidden" $align="center" $dir="row">
80
+ <Rate isRateable={false} percent={rating} size="small" />
81
+ <P
82
+ $color="grey-4"
83
+ $fontSize={12}
84
+ $lineHeight={16}
85
+ sx="margin: 0px auto 0px 4px;"
86
+ >
87
+ ({numRating})
88
+ </P>
89
+ <Box $align="center" $dir="row" $gap={8}>
90
+ {React.Children.toArray(actions)}
91
+ </Box>
92
+ </Box>
93
+ </Figcaption>
94
+ </Figure>
95
+ </Wrapper>
96
+ );
97
+ };
98
+
99
+ const Wrapper = styled.a<{ $sx?: string }>`
100
+ cursor: pointer;
101
+ display: block;
102
+ position: relative;
103
+ user-select: none;
104
+
105
+ .hidden {
106
+ display: none;
107
+ }
108
+
109
+ &:hover {
110
+ .hidden {
111
+ display: flex;
112
+ }
113
+
114
+ .not-hover {
115
+ display: none;
116
+ }
117
+
118
+ .thumbnail {
119
+ border-radius: 16px 16px 0px 0px;
120
+ }
121
+
122
+ figure {
123
+ aspect-ratio: 410 / 414;
124
+ box-shadow: var(--elevation-3);
125
+ background: linear-gradient(
126
+ 0deg,
127
+ #ffffff 50%,
128
+ rgba(255, 255, 255, 0.85) 55%,
129
+ rgba(255, 255, 255, 0.1) 80%
130
+ );
131
+ }
132
+
133
+ figcaption {
134
+ margin-top: -40px;
135
+ padding: 24px;
136
+ }
137
+ }
138
+
139
+ ${({ $sx }) => ($sx ? $sx : '')};
140
+ `;
141
+
142
+ const Figure = styled.figure`
143
+ max-width: 410px;
144
+ margin: 0px;
145
+ border-radius: 16px;
146
+
147
+ .thumbnail {
148
+ position: relative;
149
+ z-index: -1;
150
+ width: 100%;
151
+ aspect-ratio: 410 / 239;
152
+ border-radius: 16px;
153
+ }
154
+ `;
155
+
156
+ const Figcaption = styled.figcaption`
157
+ display: flex;
158
+ flex-flow: column nowrap;
159
+ gap: 8px;
160
+ padding: 8px;
161
+ `;
162
+
163
+ const DropdownWrapper = styled.div`
164
+ position: absolute;
165
+ top: 8px;
166
+ right: 8px;
167
+ `;
@@ -0,0 +1,2 @@
1
+ export { WrittenEpisodeCard } from './written';
2
+ export type { WrittenEpisodeCardProps } from './written';