@soul-refiner/design-system 1.7.10 → 1.7.12
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.
|
@@ -103,6 +103,11 @@ const Primary = styled(Box) `
|
|
|
103
103
|
background-color: var(--color-primary-blue-1);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
&:focus {
|
|
107
|
+
border: 1px solid var(--color-primary-blue-3);
|
|
108
|
+
background-color: var(--color-primary-blue-1);
|
|
109
|
+
}
|
|
110
|
+
|
|
106
111
|
&:active {
|
|
107
112
|
border: 1px solid var(--color-primary-blue-0);
|
|
108
113
|
background-color: var(--color-primary-blue-0);
|
|
@@ -120,11 +125,18 @@ const Secondary = styled(Box) `
|
|
|
120
125
|
border: 1px solid var(--color-primary-blue-4);
|
|
121
126
|
|
|
122
127
|
&:hover {
|
|
128
|
+
background-color: var(--color-primary-blue-1);
|
|
129
|
+
color: var(--color-primary-blue-1);
|
|
130
|
+
border: 1px solid var(--color-primary-blue-1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:focus {
|
|
123
134
|
border: 1px solid var(--color-primary-blue-2);
|
|
124
135
|
color: var(--color-primary-blue-1);
|
|
125
136
|
}
|
|
126
137
|
|
|
127
138
|
&:active {
|
|
139
|
+
border: 1px solid var(--color-primary-blue-0);
|
|
128
140
|
color: var(--color-primary-blue-0);
|
|
129
141
|
}
|
|
130
142
|
|
|
@@ -145,6 +157,16 @@ const Outlined = styled(Box) `
|
|
|
145
157
|
|
|
146
158
|
&:hover {
|
|
147
159
|
background-color: var(--color-grey-10);
|
|
160
|
+
border: 1px solid var(--color-grey-8);
|
|
161
|
+
|
|
162
|
+
&.icon {
|
|
163
|
+
border: 1px solid var(--color-grey-8);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&:focus {
|
|
168
|
+
background-color: var(--color-grey-10);
|
|
169
|
+
border: 1px solid var(--color-primary-blue-3);
|
|
148
170
|
|
|
149
171
|
&.icon {
|
|
150
172
|
border: 1px solid var(--color-grey-8);
|
|
@@ -153,6 +175,7 @@ const Outlined = styled(Box) `
|
|
|
153
175
|
|
|
154
176
|
&:active {
|
|
155
177
|
background-color: var(--color-grey-9);
|
|
178
|
+
border: 1px solid var(--color-grey-8);
|
|
156
179
|
}
|
|
157
180
|
|
|
158
181
|
${base}
|
|
@@ -171,6 +194,11 @@ const Danger = styled(Box) `
|
|
|
171
194
|
background-color: var(--color-red-3);
|
|
172
195
|
}
|
|
173
196
|
|
|
197
|
+
&:focus {
|
|
198
|
+
border: 1px solid var(--color-primary-blue-2);
|
|
199
|
+
background-color: var(--color-red-3);
|
|
200
|
+
}
|
|
201
|
+
|
|
174
202
|
&:active {
|
|
175
203
|
border: 1px solid var(--color-red-2);
|
|
176
204
|
background-color: var(--color-red-2);
|
|
@@ -191,6 +219,11 @@ const Text = styled(Box) `
|
|
|
191
219
|
color: var(--color-primary-blue-1);
|
|
192
220
|
}
|
|
193
221
|
|
|
222
|
+
&:focus {
|
|
223
|
+
color: var(--color-primary-blue-1);
|
|
224
|
+
border: 1px solid var(--color-primary-blue-2);
|
|
225
|
+
}
|
|
226
|
+
|
|
194
227
|
&:active {
|
|
195
228
|
color: var(--color-primary-blue-0);
|
|
196
229
|
}
|
|
@@ -238,7 +271,12 @@ const Special = styled(Box) `
|
|
|
238
271
|
color: var(--color-primary-grey-3);
|
|
239
272
|
|
|
240
273
|
&:hover {
|
|
241
|
-
color: var(--color-grey-
|
|
274
|
+
background-color: var(--color-grey-10);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&:focus {
|
|
278
|
+
background-color: var(--color-grey-10);
|
|
279
|
+
border: 1px solid var(--color-primary-blue-2);
|
|
242
280
|
}
|
|
243
281
|
|
|
244
282
|
&:active {
|
|
@@ -7,11 +7,73 @@ import { TimeAgo } from '../../atoms/time_ago/time_ago';
|
|
|
7
7
|
import { Button } from '../../actions/button';
|
|
8
8
|
import { Avatar } from '../../iconography/avatar';
|
|
9
9
|
import { Lock } from '../../../icons';
|
|
10
|
+
import { Modal } from '../modal';
|
|
11
|
+
import { ChevronLeft, ChevronRight } from '../../../icons/arrow';
|
|
10
12
|
export const Post = ({ actions, author, authorActive, authorHref, authorImage, avatarTooltipContent, avatarTooltipSx, children, content, createdDate, dropdown, hasComments, id, images, isPaywalled = false, onJoin, }) => {
|
|
11
13
|
const componentId = React.useId();
|
|
14
|
+
const [curr, setCurr] = React.useState(-1);
|
|
15
|
+
const [modalContentSize, setModalContentSize] = React.useState({
|
|
16
|
+
x: '30vw',
|
|
17
|
+
y: '30vh',
|
|
18
|
+
});
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const handleKeyEvent = (event) => {
|
|
21
|
+
if (event.key === 'ArrowLeft') {
|
|
22
|
+
handleDecrement();
|
|
23
|
+
}
|
|
24
|
+
else if (event.key === 'ArrowRight') {
|
|
25
|
+
handleIncrement();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
if (typeof document !== 'undefined') {
|
|
29
|
+
document.addEventListener('keydown', handleKeyEvent);
|
|
30
|
+
}
|
|
31
|
+
return () => {
|
|
32
|
+
document.removeEventListener('keydown', handleKeyEvent);
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
12
35
|
const _actions = React.Children.toArray(actions);
|
|
13
36
|
const _comments = React.Children.toArray(children);
|
|
37
|
+
const handleImageLoad = (event) => {
|
|
38
|
+
const { naturalHeight, naturalWidth } = event.target;
|
|
39
|
+
setModalContentSize({
|
|
40
|
+
x: `${naturalWidth}px`,
|
|
41
|
+
y: `${naturalHeight}px`,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const handleIncrement = () => {
|
|
45
|
+
setCurr((prev) => {
|
|
46
|
+
if (images?.length && prev !== images.length - 1) {
|
|
47
|
+
return prev + 1;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return prev;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const handleDecrement = () => {
|
|
55
|
+
setCurr((prev) => {
|
|
56
|
+
if (images?.length && prev !== 0) {
|
|
57
|
+
return prev - 1;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return prev;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
14
64
|
return (React.createElement(Wrapper, { id: id },
|
|
65
|
+
curr > -1 && !!images?.[curr] && (React.createElement(Modal, { controlledOpen: true, onChange: (open) => !open && setCurr(-1) },
|
|
66
|
+
React.createElement(Modal.Content, { sx: `
|
|
67
|
+
position: relative;
|
|
68
|
+
height: ${modalContentSize.y};
|
|
69
|
+
width: ${modalContentSize.x};
|
|
70
|
+
margin: 0 auto;
|
|
71
|
+
` },
|
|
72
|
+
React.createElement(NavArrow, { "$side": "left", "$visible": curr !== 0, onClick: handleDecrement },
|
|
73
|
+
React.createElement(ChevronLeft, { color: "white", size: 48 })),
|
|
74
|
+
React.createElement(Image, { alt: "", fill: true, quality: 100, onLoad: handleImageLoad, priority: true, sizes: "100vw", src: images[curr], style: { objectFit: 'contain' } }),
|
|
75
|
+
React.createElement(NavArrow, { "$side": "right", "$visible": curr !== images.length - 1, onClick: handleIncrement },
|
|
76
|
+
React.createElement(ChevronRight, { color: "white", size: 48 }))))),
|
|
15
77
|
React.createElement(Header, null,
|
|
16
78
|
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 },
|
|
17
79
|
React.createElement(TimeAgo, { date: new Date(createdDate) })), title: React.createElement(H, { as: "span", "$bold": true, "$fontSize": 18, "$lineHeight": 26 }, author), textPosition: "right", tooltipContent: avatarTooltipContent, tooltipSx: avatarTooltipSx }),
|
|
@@ -20,7 +82,7 @@ export const Post = ({ actions, author, authorActive, authorHref, authorImage, a
|
|
|
20
82
|
React.createElement(P, { "$textClampLines": isPaywalled ? 2 : undefined }, content))),
|
|
21
83
|
!!images?.length && (React.createElement(ImagesWrapper, { "$numImages": images.length, "$isPaywalled": isPaywalled },
|
|
22
84
|
images.slice(0, 4).map((url, i) => (React.createElement(ImageWrapper, { key: `${componentId}${url.slice(0, 15)}${i}` },
|
|
23
|
-
React.createElement(Image, { alt: "", fill: true, quality: 100, src: url })))),
|
|
85
|
+
React.createElement(Image, { alt: "", fill: true, onClick: () => setCurr(i), quality: 100, src: url, style: { cursor: 'pointer' } })))),
|
|
24
86
|
images.length > 4 && (React.createElement(H, { as: "p", className: "more-than", "$color": "grey-10", "$fontSize": 28, "$lineHeight": 36, "$semiBold": true },
|
|
25
87
|
"+",
|
|
26
88
|
images.length - 4)))),
|
|
@@ -127,3 +189,22 @@ const CommentWrapper = styled.div `
|
|
|
127
189
|
flex-flow: column nowrap;
|
|
128
190
|
gap: 24px;
|
|
129
191
|
`;
|
|
192
|
+
const NavArrow = styled.button `
|
|
193
|
+
width: 48px;
|
|
194
|
+
height: 150px;
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
position: fixed;
|
|
199
|
+
z-index: 100;
|
|
200
|
+
top: calc(50vh - 75px);
|
|
201
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
202
|
+
${({ $side }) => $side}: 0;
|
|
203
|
+
border-radius: ${({ $side }) => $side === 'left' ? '0 12px 12px 0' : '12px 0 0 12px'};
|
|
204
|
+
${({ $visible }) => $visible
|
|
205
|
+
? 'visibility: visible; cursor: pointer;'
|
|
206
|
+
: 'visibility: hidden; pointer-events: none;'}
|
|
207
|
+
&:hover {
|
|
208
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
209
|
+
}
|
|
210
|
+
`;
|