@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,176 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Box, H, P, Rate } from 'components';
4
+
5
+ export interface WrittenEpisodeCardProps {
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 WrittenEpisodeCard = ({
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
+ }: WrittenEpisodeCardProps) => {
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={6}
75
+ className="hidden inline"
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
+ figure {
106
+ max-width: 228px;
107
+ }
108
+
109
+ .hidden {
110
+ display: none;
111
+ }
112
+
113
+ &:hover {
114
+ .hidden {
115
+ display: flex;
116
+
117
+ &.inline {
118
+ display: -webkit-box;
119
+ }
120
+ }
121
+
122
+ .not-hover {
123
+ display: none;
124
+ }
125
+
126
+ .thumbnail {
127
+ border-radius: 16px 16px 0px 0px;
128
+ aspect-ratio: 228 / 228;
129
+ }
130
+
131
+ figure {
132
+ max-width: 280px;
133
+ aspect-ratio: 280 / 434;
134
+ box-shadow: var(--elevation-3);
135
+ background: linear-gradient(
136
+ 0deg,
137
+ #ffffff 50%,
138
+ rgba(255, 255, 255, 0.85) 55%,
139
+ rgba(255, 255, 255, 0.1) 80%
140
+ );
141
+ }
142
+
143
+ figcaption {
144
+ margin-top: -80px;
145
+ padding: 24px;
146
+ }
147
+ }
148
+
149
+ ${({ $sx }) => ($sx ? $sx : '')};
150
+ `;
151
+
152
+ const Figure = styled.figure`
153
+ margin: 0px;
154
+ border-radius: 16px;
155
+
156
+ .thumbnail {
157
+ border-radius: 16px;
158
+ position: relative;
159
+ z-index: -1;
160
+ width: 100%;
161
+ aspect-ratio: 228 / 326;
162
+ }
163
+ `;
164
+
165
+ const Figcaption = styled.figcaption`
166
+ display: flex;
167
+ flex-flow: column nowrap;
168
+ gap: 8px;
169
+ padding: 8px;
170
+ `;
171
+
172
+ const DropdownWrapper = styled.div`
173
+ position: absolute;
174
+ top: 8px;
175
+ right: 8px;
176
+ `;
@@ -186,9 +186,11 @@ const Container = styled.div<{
186
186
  $size: number;
187
187
  href?: string;
188
188
  }>`
189
+ flex-shrink: 0;
189
190
  display: flex;
190
191
  flex-flow: row nowrap;
191
- cursor: pointer;
192
+ cursor: ${({ as }) =>
193
+ as && (as === 'a' || as === 'button') ? 'pointer' : 'initial'};
192
194
  padding: 0px;
193
195
  border: 0px;
194
196
  position: relative;
@@ -196,6 +198,7 @@ const Container = styled.div<{
196
198
 
197
199
  > img,
198
200
  > svg {
201
+ flex-shrink: 0;
199
202
  border-radius: 50%;
200
203
  overflow: hidden;
201
204
  object-fit: cover;
@@ -1,5 +1,6 @@
1
1
  export * from './actions';
2
2
  export * from './atoms';
3
+ export * from './card';
3
4
  export * from './feedback';
4
5
  export * from './iconography';
5
6
  export * from './input';