@meduza/ui-kit-2 0.7.2 → 0.7.3
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.
- package/dist/Meta/Meta.mock.d.ts +12 -0
- package/dist/RelatedBook/RelatedBook.mock.d.ts +65 -0
- package/dist/RelatedBook/RelatedBook.types.d.ts +4 -0
- package/dist/RelatedBook/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/Meta/Meta.mock.ts +19 -0
- package/src/RelatedBook/RelatedBook.mock.ts +68 -0
- package/src/RelatedBook/RelatedBook.module.css +210 -0
- package/src/RelatedBook/RelatedBook.stories.module.css +5 -0
- package/src/RelatedBook/RelatedBook.stories.tsx +35 -0
- package/src/RelatedBook/RelatedBook.test.tsx +20 -0
- package/src/RelatedBook/RelatedBook.types.ts +4 -0
- package/src/RelatedBook/index.tsx +68 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export declare const RelatedBookMock: {
|
|
2
|
+
type: string;
|
|
3
|
+
data: {
|
|
4
|
+
url: string;
|
|
5
|
+
cover: {
|
|
6
|
+
urls: {
|
|
7
|
+
w325: {
|
|
8
|
+
'1x': string;
|
|
9
|
+
'2x': string;
|
|
10
|
+
'1x_webp': string;
|
|
11
|
+
'2x_webp': string;
|
|
12
|
+
};
|
|
13
|
+
w600: {
|
|
14
|
+
'1x': string;
|
|
15
|
+
'2x': string;
|
|
16
|
+
'1x_webp': string;
|
|
17
|
+
'2x_webp': string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
blocks: ({
|
|
22
|
+
type: string;
|
|
23
|
+
data: {
|
|
24
|
+
text: string;
|
|
25
|
+
theme: string;
|
|
26
|
+
first?: undefined;
|
|
27
|
+
second?: undefined;
|
|
28
|
+
lang?: undefined;
|
|
29
|
+
components?: undefined;
|
|
30
|
+
};
|
|
31
|
+
id: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: string;
|
|
34
|
+
data: {
|
|
35
|
+
first: string;
|
|
36
|
+
second: string;
|
|
37
|
+
text?: undefined;
|
|
38
|
+
theme?: undefined;
|
|
39
|
+
lang?: undefined;
|
|
40
|
+
components?: undefined;
|
|
41
|
+
};
|
|
42
|
+
id: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: string;
|
|
45
|
+
data: {
|
|
46
|
+
lang: string;
|
|
47
|
+
components: {
|
|
48
|
+
type: string;
|
|
49
|
+
text: string;
|
|
50
|
+
id: string;
|
|
51
|
+
}[];
|
|
52
|
+
text?: undefined;
|
|
53
|
+
theme?: undefined;
|
|
54
|
+
first?: undefined;
|
|
55
|
+
second?: undefined;
|
|
56
|
+
};
|
|
57
|
+
id: string;
|
|
58
|
+
})[];
|
|
59
|
+
theme: {
|
|
60
|
+
background_color: string;
|
|
61
|
+
text_color: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
id: string;
|
|
65
|
+
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const MetaMock = {
|
|
2
|
+
type: 'meta',
|
|
3
|
+
data: {
|
|
4
|
+
lang: 'ru',
|
|
5
|
+
components: [
|
|
6
|
+
{
|
|
7
|
+
type: 'string',
|
|
8
|
+
text: '42 страницы',
|
|
9
|
+
id: 'e19bcbc2fc5005393177a48818801a6e04e3a5e94aad52ed99f6d6addd4819e5'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'string',
|
|
13
|
+
text: 'Сентябрь, 2023',
|
|
14
|
+
id: 'c5c779fd7088cda5667daedccd35c31e3fe70233e60941ae42965b7d1863302c'
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
id: '2-219b4aed9da90196465bd1c697b643ffffa219cbcdd325a8abcedc053c6649b0'
|
|
19
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export const RelatedBookMock = {
|
|
2
|
+
type: 'related_book',
|
|
3
|
+
data: {
|
|
4
|
+
url: 'book_landing/2023/09/13/testovyy-avtor',
|
|
5
|
+
cover: {
|
|
6
|
+
urls: {
|
|
7
|
+
w325: {
|
|
8
|
+
'1x': '//meduza.io/impro/D6driXI8j0K_j-YQVCRUQN8HW49p5I_7pDiKBiI07XI/resizing_type:fit/width:325/height:0/enlarge:1/quality:80/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.png',
|
|
9
|
+
'2x': '//meduza.io/impro/Z6f_I7RgoLm1qndCIVSeIbosuXLvb5wgQorVhzQbrTA/resizing_type:fit/width:650/height:0/enlarge:1/quality:80/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.png',
|
|
10
|
+
'1x_webp':
|
|
11
|
+
'//meduza.io/impro/SB0AN46D0ObVaIwyMv3Wj1VR0y9C2H-uSwyHkPtAbDI/resizing_type:fit/width:325/height:0/enlarge:1/quality:95/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.webp',
|
|
12
|
+
'2x_webp':
|
|
13
|
+
'//meduza.io/impro/iR5SsfQPNONtjHRLAdVPHYTpgKsyYZQWuxr4qOQ2WXo/resizing_type:fit/width:650/height:0/enlarge:1/quality:95/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.webp'
|
|
14
|
+
},
|
|
15
|
+
w600: {
|
|
16
|
+
'1x': '//meduza.io/impro/UoG3H-fSGcAX54b2btJT8HK69JHOXOCkR4nfgI5T8BE/resizing_type:fit/width:600/height:0/enlarge:1/quality:80/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.png',
|
|
17
|
+
'2x': '//meduza.io/impro/yLXyIx4_Bi9O1Gkbv-uxFIk-FmRfYR2DAZ1bpZgxlAs/resizing_type:fit/width:1200/height:0/enlarge:1/quality:80/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.png',
|
|
18
|
+
'1x_webp':
|
|
19
|
+
'//meduza.io/impro/LuunCbINkOTFj49bgrU7LfXrFqkmj6endeyG4cyao1U/resizing_type:fit/width:600/height:0/enlarge:1/quality:95/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.webp',
|
|
20
|
+
'2x_webp':
|
|
21
|
+
'//meduza.io/impro/PMsuWNtzhy6QCyOwkDXqELMZOAeSdCv_sN_lTYFaFYE/resizing_type:fit/width:1200/height:0/enlarge:1/quality:95/aHR0cHM6Ly9zZWNv/bmQubWVkdXphLmlv/L2ltYWdlL2F0dGFj/aG1lbnRzL2ltYWdl/cy8wMDQvNTYxLzg1/MS9vcmlnaW5hbC9j/bUd3ZVlRNlpmUHpJ/cnczNmdFbFRBLnBu/Zw.webp'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
blocks: [
|
|
26
|
+
{
|
|
27
|
+
type: 'tag',
|
|
28
|
+
data: {
|
|
29
|
+
text: 'Читайте также (это заг блока)',
|
|
30
|
+
theme: 'custom'
|
|
31
|
+
},
|
|
32
|
+
id: '0-12a13e7197cca39855b3f53299c6e4148bea63f4a7da0406be27c49f4b211702'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'rich_title',
|
|
36
|
+
data: {
|
|
37
|
+
first: 'Тестовый автор',
|
|
38
|
+
second: 'Тестовое название книги'
|
|
39
|
+
},
|
|
40
|
+
id: '1-87b217057d08b7f1a65dd75fb7a1e4e20a4119d40f7a4562fefc3591d2a02857'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'meta',
|
|
44
|
+
data: {
|
|
45
|
+
lang: 'ru',
|
|
46
|
+
components: [
|
|
47
|
+
{
|
|
48
|
+
type: 'string',
|
|
49
|
+
text: '300 страниц',
|
|
50
|
+
id: 'd06a9c997243be8443acd0dd1509a66dab38a112efc35f76933e9761721f88c6'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'string',
|
|
54
|
+
text: 'Сентябрь 2023',
|
|
55
|
+
id: '99a1c1c8d4da9ccb01453d01400cdcd63d989f92f8302e5ae5931e5da061cf9e'
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
id: '2-cf782d69edb4aa4fef3e01689750394759436881b849faee4021e7a421fcf251'
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
theme: {
|
|
63
|
+
background_color: '11,36,89',
|
|
64
|
+
text_color: '255,255,255'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
id: '3-b790d1d4382de253a60ba2e36d274cdd528aa4c5c101c2901ce058f81569e9ec'
|
|
68
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
@import '../vars.css';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: 1;
|
|
6
|
+
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-flow: column nowrap;
|
|
9
|
+
flex-grow: 1;
|
|
10
|
+
|
|
11
|
+
width: 100%;
|
|
12
|
+
margin: 16px 0;
|
|
13
|
+
|
|
14
|
+
transition: opacity 0.2s;
|
|
15
|
+
text-decoration: none;
|
|
16
|
+
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
outline-width: 0;
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
21
|
+
@media $portraitTablet {
|
|
22
|
+
margin: 25px 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.root:last-child {
|
|
27
|
+
margin-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.root:first-child {
|
|
31
|
+
margin-top: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.root:hover {
|
|
35
|
+
@media $landscapeTablet {
|
|
36
|
+
z-index: 10;
|
|
37
|
+
|
|
38
|
+
opacity: 0.95;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.container {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-flow: column nowrap;
|
|
45
|
+
flex-grow: 1;
|
|
46
|
+
|
|
47
|
+
border-radius: inherit;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.imageWrap {
|
|
51
|
+
position: relative;
|
|
52
|
+
|
|
53
|
+
width: 100%;
|
|
54
|
+
|
|
55
|
+
border-radius: 8px 8px 0 0;
|
|
56
|
+
|
|
57
|
+
@media $landscapeTablet {
|
|
58
|
+
min-height: 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.container {
|
|
63
|
+
background-color: var(--bgColor);
|
|
64
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.image {
|
|
68
|
+
position: relative;
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
|
|
74
|
+
transition: opacity 350ms ease;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.picture {
|
|
78
|
+
height: 160px;
|
|
79
|
+
|
|
80
|
+
box-shadow:
|
|
81
|
+
0 0 0 0 rgba(0, 0, 0, 0.1),
|
|
82
|
+
0 4px 8px 0 rgba(0, 0, 0, 0.1),
|
|
83
|
+
0 15px 15px 0 rgba(0, 0, 0, 0.09),
|
|
84
|
+
0 34px 20px 0 rgba(0, 0, 0, 0.05),
|
|
85
|
+
0 60px 24px 0 rgba(0, 0, 0, 0.01),
|
|
86
|
+
0 94px 26px 0 rgba(0, 0, 0, 0);
|
|
87
|
+
|
|
88
|
+
@media $landscapeTablet {
|
|
89
|
+
height: 200px;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.picture img {
|
|
94
|
+
display: block;
|
|
95
|
+
|
|
96
|
+
width: auto;
|
|
97
|
+
height: 100%;
|
|
98
|
+
|
|
99
|
+
object-fit: contain;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.tag {
|
|
103
|
+
display: flex;
|
|
104
|
+
|
|
105
|
+
margin-bottom: 6px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.contentWrap {
|
|
109
|
+
z-index: 1;
|
|
110
|
+
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
flex-grow: 1;
|
|
114
|
+
|
|
115
|
+
width: 100%;
|
|
116
|
+
padding: 0 15px;
|
|
117
|
+
|
|
118
|
+
@media $landscapeTablet {
|
|
119
|
+
padding: 0 15px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.contentWrap {
|
|
124
|
+
@media $landscapeTablet {
|
|
125
|
+
justify-content: flex-end;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.content {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
flex-grow: 1;
|
|
133
|
+
|
|
134
|
+
padding: $gapSmall 0;
|
|
135
|
+
|
|
136
|
+
@media $landscapeTablet {
|
|
137
|
+
justify-content: flex-end;
|
|
138
|
+
|
|
139
|
+
padding: 15px 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.title {
|
|
144
|
+
max-width: 770px;
|
|
145
|
+
margin-bottom: 12px;
|
|
146
|
+
|
|
147
|
+
@media $mobile {
|
|
148
|
+
width: 100%;
|
|
149
|
+
min-width: 0;
|
|
150
|
+
margin-bottom: 15px;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.footer {
|
|
155
|
+
margin-top: auto;
|
|
156
|
+
|
|
157
|
+
color: #757575;
|
|
158
|
+
|
|
159
|
+
line-height: 14px;
|
|
160
|
+
|
|
161
|
+
fill: currentColor;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.imageWrap {
|
|
165
|
+
padding-top: 50px;
|
|
166
|
+
padding-bottom: 50px;
|
|
167
|
+
|
|
168
|
+
@media $landscapeTablet {
|
|
169
|
+
position: static;
|
|
170
|
+
|
|
171
|
+
flex-shrink: 0;
|
|
172
|
+
|
|
173
|
+
padding-top: 40px;
|
|
174
|
+
padding-bottom: 40px;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.content {
|
|
179
|
+
flex-shrink: 0;
|
|
180
|
+
|
|
181
|
+
padding-top: 0;
|
|
182
|
+
|
|
183
|
+
@media $landscapeTablet {
|
|
184
|
+
flex-grow: 0;
|
|
185
|
+
justify-content: flex-end;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.center {
|
|
190
|
+
width: 100%;
|
|
191
|
+
max-width: 650px;
|
|
192
|
+
margin-right: auto;
|
|
193
|
+
margin-left: auto;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.isLight .content {
|
|
197
|
+
color: #fff;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.isDark .content {
|
|
201
|
+
--tagColor: rgba(0, 0, 0, 0.6);
|
|
202
|
+
--metaText: rgba(0, 0, 0, 0.6);
|
|
203
|
+
--metaFill: currentColor;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.isLight .content {
|
|
207
|
+
--tagColor: rgba(254, 255, 255, 0.5);
|
|
208
|
+
--metaText: rgba(254, 255, 255, 0.5);
|
|
209
|
+
--metaFill: currentColor;
|
|
210
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RelatedBook } from './'
|
|
3
|
+
import { PreviewWrapper } from '../_storybook/PreviewWrapper'
|
|
4
|
+
|
|
5
|
+
import styles from './RelatedBook.stories.module.css'
|
|
6
|
+
import { RelatedBookMock } from './RelatedBook.mock'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Main / RelatedBook',
|
|
10
|
+
component: RelatedBook,
|
|
11
|
+
parameters: {
|
|
12
|
+
themeWrapperSideBySide: true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Example: React.FC = () => {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<div className={styles.root}>
|
|
20
|
+
<RelatedBook block={RelatedBookMock} styleContext={['center']} />
|
|
21
|
+
</div>
|
|
22
|
+
</>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Default: React.FC = () => (
|
|
27
|
+
<>
|
|
28
|
+
<PreviewWrapper theme="light">
|
|
29
|
+
<Example />
|
|
30
|
+
</PreviewWrapper>
|
|
31
|
+
<PreviewWrapper theme="dark">
|
|
32
|
+
<Example />
|
|
33
|
+
</PreviewWrapper>
|
|
34
|
+
</>
|
|
35
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { RelatedBook } from './'
|
|
4
|
+
import { RelatedBookProps } from './RelatedBook.types'
|
|
5
|
+
|
|
6
|
+
import styles from './RelatedBook.module.css'
|
|
7
|
+
|
|
8
|
+
describe('RelatedBook', () => {
|
|
9
|
+
let props: RelatedBookProps
|
|
10
|
+
|
|
11
|
+
const renderComponent = () => render(<RelatedBook {...props} />)
|
|
12
|
+
|
|
13
|
+
it('should have root style', () => {
|
|
14
|
+
const { getByTestId } = renderComponent()
|
|
15
|
+
|
|
16
|
+
const relatedBook = getByTestId('related-book')
|
|
17
|
+
|
|
18
|
+
expect(relatedBook).toHaveClass(styles.root)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { RelatedBookProps } from './RelatedBook.types'
|
|
3
|
+
import makeClassName, { ClassNames } from '../utils/makeClassName'
|
|
4
|
+
import { Link } from 'react-router-dom'
|
|
5
|
+
|
|
6
|
+
import styles from './RelatedBook.module.css'
|
|
7
|
+
import { RenderBlocks } from '../RenderBlocks'
|
|
8
|
+
import { Image } from '../Image'
|
|
9
|
+
import makeStyleContext from '../utils/makeStyleContext'
|
|
10
|
+
|
|
11
|
+
export const RelatedBook: React.FC<RelatedBookProps> = ({
|
|
12
|
+
block,
|
|
13
|
+
styleContext
|
|
14
|
+
}) => {
|
|
15
|
+
const theme = block.data.theme.text_color === '0,0,0' ? 'isDark' : 'isLight'
|
|
16
|
+
|
|
17
|
+
let classNames: ClassNames = [
|
|
18
|
+
[styles.root, true],
|
|
19
|
+
[styles[theme], theme],
|
|
20
|
+
[
|
|
21
|
+
styles[block.data.onlyOn],
|
|
22
|
+
!!block.data.onlyOn && !!styles[block.data.onlyOn]
|
|
23
|
+
]
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
if (styleContext) {
|
|
27
|
+
classNames = makeStyleContext(classNames, styleContext, styles)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const cssProps = {
|
|
31
|
+
'--bgColor': `rgb(${block.data.theme.background_color || '0, 0, 0'})`
|
|
32
|
+
} as React.CSSProperties
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Link
|
|
36
|
+
to={`/${block.data.url}`}
|
|
37
|
+
className={makeClassName(classNames)}
|
|
38
|
+
style={cssProps}
|
|
39
|
+
>
|
|
40
|
+
<div className={styles.container}>
|
|
41
|
+
<div className={styles.imageWrap}>
|
|
42
|
+
<div className={styles.image}>
|
|
43
|
+
<picture className={styles.picture}>
|
|
44
|
+
<Image
|
|
45
|
+
optimized={block.data.cover.urls}
|
|
46
|
+
ratio={0}
|
|
47
|
+
display="narrow"
|
|
48
|
+
styleContext={['isStatic']}
|
|
49
|
+
lazy={true}
|
|
50
|
+
/>
|
|
51
|
+
</picture>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div className={styles.contentWrap}>
|
|
55
|
+
<div className={styles.content}>
|
|
56
|
+
{block.data.blocks.map((item) => (
|
|
57
|
+
<RenderBlocks
|
|
58
|
+
key={item.id}
|
|
59
|
+
block={item}
|
|
60
|
+
styleContext={['isInMediaBlock', 'isInBookRelated', 'isCustom']}
|
|
61
|
+
/>
|
|
62
|
+
))}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</Link>
|
|
67
|
+
)
|
|
68
|
+
}
|