@meduza/ui-kit-2 1.4.0 → 1.4.2
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/ui-kit-2.cjs.development.js +9 -42
- package/dist/ui-kit-2.cjs.development.js.map +1 -1
- package/dist/ui-kit-2.cjs.production.min.js +1 -1
- package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
- package/dist/ui-kit-2.esm.js +9 -42
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit-game.css +56 -258
- package/dist/ui-kit.css +56 -258
- package/package.json +1 -1
- package/src/Image/Image.module.css +16 -7
- package/src/Meta/Meta.module.css +4 -0
- package/src/RelatedRichBlock/RelatedRichBlock.module.css +28 -201
- package/src/RelatedRichBlock/index.tsx +11 -64
- package/src/RichTitle/RichTitle.module.css +8 -12
- package/src/Tag/Tag.module.css +0 -1
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
z-index: 10;
|
|
4
4
|
|
|
5
|
-
display:
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-flow: column nowrap;
|
|
7
|
+
gap: 20px;
|
|
8
|
+
|
|
9
|
+
padding: 10px 20px 20px;
|
|
6
10
|
overflow: hidden;
|
|
7
11
|
|
|
8
12
|
text-decoration: none;
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
background-color: #f7f7f7;
|
|
15
|
+
|
|
16
|
+
border-top: 2px solid #b78a54;
|
|
17
|
+
|
|
11
18
|
outline-width: 0;
|
|
19
|
+
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
.root:hover {
|
|
@@ -17,32 +25,7 @@
|
|
|
17
25
|
}
|
|
18
26
|
}
|
|
19
27
|
|
|
20
|
-
.root
|
|
21
|
-
position: absolute;
|
|
22
|
-
top: 0;
|
|
23
|
-
right: 0;
|
|
24
|
-
bottom: 0;
|
|
25
|
-
left: 0;
|
|
26
|
-
z-index: 20;
|
|
27
|
-
|
|
28
|
-
border-radius: 8px;
|
|
29
|
-
|
|
30
|
-
content: '';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.root::before {
|
|
34
|
-
display: block;
|
|
35
|
-
|
|
36
|
-
width: 100%;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.root::after {
|
|
40
|
-
box-shadow: inset 0 4px #b88b59, inset 0 5px rgba(0, 0, 0, 0.2),
|
|
41
|
-
inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.root,
|
|
45
|
-
.wrapper {
|
|
28
|
+
.root {
|
|
46
29
|
margin: 16px 0;
|
|
47
30
|
|
|
48
31
|
@media $portraitTablet {
|
|
@@ -50,180 +33,41 @@
|
|
|
50
33
|
}
|
|
51
34
|
}
|
|
52
35
|
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
left: 0;
|
|
58
|
-
z-index: 10;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.overlay {
|
|
62
|
-
bottom: 0;
|
|
63
|
-
|
|
64
|
-
height: 295px;
|
|
36
|
+
.content {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-flow: row nowrap;
|
|
39
|
+
gap: 20px;
|
|
65
40
|
}
|
|
66
41
|
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
height: 150px;
|
|
42
|
+
.cover {
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
width: 200px;
|
|
71
45
|
}
|
|
72
46
|
|
|
73
47
|
.body {
|
|
74
48
|
display: flex;
|
|
75
49
|
flex-flow: column nowrap;
|
|
76
|
-
justify-content: flex-end;
|
|
77
|
-
|
|
78
|
-
padding: 12px 15px;
|
|
79
|
-
|
|
80
|
-
background-color: #f7f7f7;
|
|
81
|
-
|
|
82
|
-
@media $mobile {
|
|
83
|
-
position: absolute;
|
|
84
|
-
right: 0;
|
|
85
|
-
bottom: 0;
|
|
86
|
-
left: 0;
|
|
87
|
-
z-index: 10;
|
|
88
|
-
|
|
89
|
-
min-height: 295px;
|
|
90
|
-
padding: 20px;
|
|
91
|
-
|
|
92
|
-
background-color: transparent;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.isRich {
|
|
97
|
-
color: #000;
|
|
98
|
-
|
|
99
|
-
@media $mobile {
|
|
100
|
-
color: #fff;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.isRich.hasGradient .body {
|
|
105
|
-
@media $mobile {
|
|
106
|
-
position: absolute;
|
|
107
|
-
right: 0;
|
|
108
|
-
bottom: 0;
|
|
109
|
-
left: 0;
|
|
110
|
-
z-index: 10;
|
|
111
|
-
|
|
112
|
-
min-height: 295px;
|
|
113
|
-
|
|
114
|
-
background-color: transparent;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.isRich .picture {
|
|
119
|
-
position: relative;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.isRich .picture::after {
|
|
123
|
-
position: absolute;
|
|
124
|
-
right: 1px;
|
|
125
|
-
bottom: 0;
|
|
126
|
-
left: 1px;
|
|
127
|
-
z-index: 10;
|
|
128
|
-
|
|
129
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
130
|
-
|
|
131
|
-
content: '';
|
|
132
|
-
|
|
133
|
-
@media $mobile {
|
|
134
|
-
content: '';
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.isCard {
|
|
139
|
-
color: #fff;
|
|
140
|
-
|
|
141
|
-
background-color: #191919;
|
|
142
|
-
|
|
143
|
-
@media $mobile {
|
|
144
|
-
min-height: 350px;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.isCard .body {
|
|
149
|
-
background-color: transparent;
|
|
150
|
-
|
|
151
|
-
@media $mobile {
|
|
152
|
-
position: absolute;
|
|
153
|
-
right: 0;
|
|
154
|
-
bottom: 0;
|
|
155
|
-
left: 0;
|
|
156
|
-
z-index: 10;
|
|
157
|
-
|
|
158
|
-
min-height: 295px;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.isCard::before {
|
|
163
|
-
@media $mobile {
|
|
164
|
-
padding-bottom: 66.66%;
|
|
165
|
-
|
|
166
|
-
content: '';
|
|
167
|
-
}
|
|
168
50
|
}
|
|
169
51
|
|
|
170
52
|
.isCard .cover {
|
|
171
53
|
position: relative;
|
|
172
54
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
position: absolute;
|
|
177
|
-
top: 0;
|
|
178
|
-
bottom: 0;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.isCard .cover::before {
|
|
183
|
-
display: block;
|
|
184
|
-
|
|
185
|
-
padding-bottom: 78.50746269%;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
186
58
|
|
|
187
|
-
|
|
59
|
+
background-color: #191919;
|
|
188
60
|
|
|
189
|
-
|
|
190
|
-
content: none;
|
|
191
|
-
}
|
|
61
|
+
aspect-ratio: 1 / 1;
|
|
192
62
|
}
|
|
193
63
|
|
|
194
|
-
.isCard .
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
left: 50%;
|
|
198
|
-
|
|
199
|
-
width: 180px;
|
|
200
|
-
height: 180px;
|
|
201
|
-
|
|
202
|
-
transform: translate(-50%, -50%);
|
|
203
|
-
|
|
204
|
-
@media $mobile {
|
|
205
|
-
top: 25%;
|
|
206
|
-
|
|
207
|
-
transform: translate(-50%, -25%);
|
|
208
|
-
}
|
|
64
|
+
.isCard .cover > div {
|
|
65
|
+
width: 100px;
|
|
66
|
+
height: 100px;
|
|
209
67
|
}
|
|
210
68
|
|
|
211
69
|
.tag {
|
|
212
|
-
|
|
213
|
-
top: 14px;
|
|
214
|
-
right: 15px;
|
|
215
|
-
left: 15px;
|
|
216
|
-
z-index: 10;
|
|
217
|
-
|
|
218
|
-
color: rgba(255, 255, 255, 0.7);
|
|
219
|
-
|
|
220
|
-
font-size: 12px;
|
|
221
|
-
|
|
222
|
-
@media $landscapeTablet {
|
|
223
|
-
top: 16px;
|
|
224
|
-
right: 20px;
|
|
225
|
-
left: 20px;
|
|
226
|
-
}
|
|
70
|
+
color: rgba(0, 0, 0, 0.5);
|
|
227
71
|
}
|
|
228
72
|
|
|
229
73
|
.center {
|
|
@@ -233,23 +77,6 @@
|
|
|
233
77
|
margin-left: auto;
|
|
234
78
|
}
|
|
235
79
|
|
|
236
|
-
/* Themes */
|
|
237
|
-
|
|
238
|
-
.isRich.dark {
|
|
239
|
-
color: #000;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.isRich.dark .tag {
|
|
243
|
-
color: rgba(0, 0, 0, 0.7);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.isRich.light {
|
|
247
|
-
@media $mobile {
|
|
248
|
-
color: #fff;
|
|
249
|
-
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
80
|
/* Display */
|
|
254
81
|
|
|
255
82
|
.mobile {
|
|
@@ -262,6 +89,6 @@
|
|
|
262
89
|
display: none;
|
|
263
90
|
|
|
264
91
|
@media $mobile {
|
|
265
|
-
display:
|
|
92
|
+
display: flex;
|
|
266
93
|
}
|
|
267
94
|
}
|
|
@@ -1,59 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useEffect } from 'react'
|
|
1
|
+
import React from 'react'
|
|
3
2
|
import { Link } from 'react-router-dom'
|
|
4
3
|
|
|
5
|
-
import { useInView } from 'react-intersection-observer'
|
|
6
4
|
import { RelatedRichBlockProps } from './RelatedRichBlock.types'
|
|
7
5
|
|
|
8
|
-
import postMessage from '../utils/postMessage'
|
|
9
6
|
import { makeClassName, ClassNames } from '../utils/makeClassName'
|
|
10
7
|
import makeStyleContext from '../utils/makeStyleContext'
|
|
11
|
-
import generateGradient from '../utils/generateGradient'
|
|
12
8
|
import { toCapitalize } from '../utils/converCase'
|
|
13
9
|
|
|
14
10
|
import { Tag } from '../Tag'
|
|
15
|
-
import { RenderBlocks } from '../RenderBlocks'
|
|
16
11
|
import { Image } from '../Image'
|
|
17
12
|
|
|
18
13
|
import styles from './RelatedRichBlock.module.css'
|
|
14
|
+
import { RenderBlocks } from '../RenderBlocks'
|
|
19
15
|
|
|
20
16
|
export const RelatedRichBlock: React.FC<RelatedRichBlockProps> = ({
|
|
21
17
|
block: {
|
|
22
18
|
only_on: onlyOn,
|
|
23
19
|
data: {
|
|
24
|
-
blocks,
|
|
25
20
|
url,
|
|
21
|
+
blocks,
|
|
26
22
|
cover: { urls, gradients, tag, layout, ratio }
|
|
27
23
|
}
|
|
28
24
|
},
|
|
29
25
|
styleContext
|
|
30
26
|
}) => {
|
|
31
|
-
const style: React.CSSProperties = {}
|
|
32
|
-
const styleHeader: React.CSSProperties = {}
|
|
33
|
-
|
|
34
27
|
const cardType = `is${toCapitalize(layout)}`
|
|
35
28
|
|
|
36
|
-
const [ref, inView] = useInView({
|
|
37
|
-
threshold: 0,
|
|
38
|
-
triggerOnce: true
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (inView) {
|
|
43
|
-
if (
|
|
44
|
-
(onlyOn === 'mobile' && window.innerWidth <= 511) ||
|
|
45
|
-
(onlyOn === 'desktop' && window.innerWidth >= 512) ||
|
|
46
|
-
!onlyOn
|
|
47
|
-
) {
|
|
48
|
-
postMessage('richRelated', url, 'view')
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}, [inView])
|
|
52
|
-
|
|
53
|
-
const handleClick = () => {
|
|
54
|
-
postMessage('richRelated', url, 'click')
|
|
55
|
-
}
|
|
56
|
-
|
|
57
29
|
let classNames: ClassNames = [
|
|
58
30
|
[styles.root, true],
|
|
59
31
|
[styles[cardType], !!layout && !!styles[cardType]],
|
|
@@ -69,52 +41,27 @@ export const RelatedRichBlock: React.FC<RelatedRichBlockProps> = ({
|
|
|
69
41
|
context = [...styleContext, 'isInMediaBlock']
|
|
70
42
|
}
|
|
71
43
|
|
|
72
|
-
if (gradients) {
|
|
73
|
-
styleHeader.backgroundImage = generateGradient(
|
|
74
|
-
gradients.bg_rgb,
|
|
75
|
-
'mediaBlockTop'
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light']
|
|
79
|
-
classNames = makeStyleContext(classNames, theme, styles)
|
|
80
|
-
|
|
81
|
-
if (onlyOn === 'desktop') {
|
|
82
|
-
style.backgroundImage = generateGradient(
|
|
83
|
-
gradients.bg_rgb,
|
|
84
|
-
'mediaBlockBottom'
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
44
|
return (
|
|
90
45
|
<Link
|
|
91
46
|
data-testid="related-rich-block"
|
|
92
47
|
className={makeClassName(classNames)}
|
|
93
48
|
to={`/${url}`}
|
|
94
|
-
onClick={(): void => handleClick()}
|
|
95
|
-
ref={ref}
|
|
96
49
|
>
|
|
97
|
-
{layout === 'rich' && (
|
|
98
|
-
<>
|
|
99
|
-
<div className={styles.overlay} style={style} />
|
|
100
|
-
<div className={styles.overlayHeader} style={styleHeader} />
|
|
101
|
-
</>
|
|
102
|
-
)}
|
|
103
|
-
|
|
104
50
|
<div className={styles.tag}>
|
|
105
51
|
<Tag size="small" theme="inherit" styleContext="richRelated">
|
|
106
52
|
{tag}
|
|
107
53
|
</Tag>
|
|
108
54
|
</div>
|
|
109
|
-
|
|
110
|
-
|
|
55
|
+
|
|
56
|
+
<div className={styles.content}>
|
|
57
|
+
<div className={styles.cover}>
|
|
111
58
|
<Image optimized={urls} ratio={ratio} display="narrow" />
|
|
112
59
|
</div>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
60
|
+
<div className={styles.body}>
|
|
61
|
+
{blocks.map((item) => (
|
|
62
|
+
<RenderBlocks key={item.id} block={item} styleContext={context} />
|
|
63
|
+
))}
|
|
64
|
+
</div>
|
|
118
65
|
</div>
|
|
119
66
|
</Link>
|
|
120
67
|
)
|
|
@@ -100,26 +100,22 @@
|
|
|
100
100
|
text-align: left;
|
|
101
101
|
|
|
102
102
|
@media $landscapeTablet {
|
|
103
|
-
margin-bottom:
|
|
103
|
+
margin-bottom: 16px;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.isInMediaBlock:not(.featured) {
|
|
108
|
-
font-size:
|
|
109
|
-
line-height:
|
|
110
|
-
|
|
111
|
-
@media $landscapeTablet {
|
|
112
|
-
font-size: 1.3rem;
|
|
113
|
-
line-height: 1.6rem;
|
|
114
|
-
}
|
|
108
|
+
font-size: 20px;
|
|
109
|
+
line-height: 130%;
|
|
115
110
|
}
|
|
116
111
|
|
|
117
112
|
.isInMediaBlock:not(.featured) span {
|
|
118
|
-
|
|
113
|
+
display: block;
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
115
|
+
margin-top: 4px;
|
|
116
|
+
|
|
117
|
+
font-size: 18px;
|
|
118
|
+
line-height: 132%;
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
.isInBookRelated {
|