@meduza/ui-kit-2 0.1.26 → 0.1.28

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.26",
2
+ "version": "0.1.28",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -5,7 +5,7 @@
5
5
 
6
6
  font-family: $secondaryFont;
7
7
  font-size: 12px;
8
- line-height: 14px;
8
+ line-height: 15px;
9
9
 
10
10
  fill: inherit;
11
11
  }
@@ -20,7 +20,7 @@
20
20
  .isInMaterial {
21
21
  width: 100%;
22
22
 
23
- color: $nikel;
23
+ color: rgba(0, 0, 0, 0.4);
24
24
  }
25
25
 
26
26
  .podcast {
@@ -31,6 +31,7 @@
31
31
  color: rgba(255, 255, 255, 0.7);
32
32
  }
33
33
 
34
+ .center.isInMediaBlock,
34
35
  .center.half {
35
36
  @media $landscapeTablet {
36
37
  text-align: left;
@@ -1,4 +1,6 @@
1
1
  import React from 'react'
2
+ import { toCamel } from '../utils/converCase'
3
+
2
4
  import { MetaContainerProps } from './Meta.types'
3
5
  import { Meta } from './'
4
6
  import { MetaItem } from '../MetaItem'
@@ -8,6 +10,8 @@ import { BookmarkButton } from '../BookmarkButton'
8
10
  import { Timestamp } from '../Timestamp'
9
11
  import { SvgSymbol } from '../SvgSymbol'
10
12
 
13
+ import { TimestampProps } from '../Timestamp/Timestamp.types'
14
+
11
15
  import styles from './Meta.module.css'
12
16
 
13
17
  export const MetaContainer: React.FC<MetaContainerProps> = ({
@@ -68,6 +72,9 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
68
72
  )
69
73
  }
70
74
  case 'datetime': {
75
+ const format = (toCamel(component.format) ||
76
+ 'date') as TimestampProps['type']
77
+
71
78
  return (
72
79
  <MetaItem
73
80
  hasSource={hasSource}
@@ -77,7 +84,7 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
77
84
  >
78
85
  <Timestamp
79
86
  publishedAt={component.datetime}
80
- type="date"
87
+ type={format || 'date'}
81
88
  locale={lang}
82
89
  />
83
90
  </MetaItem>
@@ -7,15 +7,12 @@
7
7
  display: block;
8
8
  overflow: hidden;
9
9
 
10
- min-height: 434px;
11
-
12
10
  text-decoration: none;
13
11
 
14
12
  border-radius: 8px;
15
13
  outline-width: 0;
16
14
  }
17
15
 
18
- .root::before,
19
16
  .root::after {
20
17
  position: absolute;
21
18
  z-index: 20;
@@ -30,11 +27,14 @@
30
27
  }
31
28
 
32
29
  .root::before {
33
- border: 1px solid rgba(0, 0, 0, 0.1);
30
+ display: block;
31
+
32
+ width: 100%;
34
33
  }
35
34
 
36
35
  .root::after {
37
- box-shadow: inset 0 4px #b88b59, inset 0 5px rgba(0, 0, 0, 0.2);
36
+ box-shadow: inset 0 4px #b88b59, inset 0 5px rgba(0, 0, 0, 0.2),
37
+ inset 0 0 0 1px rgba(0, 0, 0, 0.1);
38
38
  }
39
39
 
40
40
  .root,
@@ -66,24 +66,16 @@
66
66
  height: 150px;
67
67
  }
68
68
 
69
- .isRich .overlayHeader {
70
- background: linear-gradient(
71
- 180deg,
72
- rgba(0, 0, 0, 0.5) 0%,
73
- rgba(0, 0, 0, 0) 97%
74
- );
75
- }
76
-
77
69
  .body {
78
70
  display: flex;
79
71
  flex-flow: column nowrap;
80
72
  justify-content: flex-end;
81
73
 
82
- padding: 15px;
74
+ padding: 15px 15px 12px;
83
75
 
84
76
  background-color: #f7f7f7;
85
77
 
86
- @media $mobile {
78
+ @media $landscapeTablet {
87
79
  position: absolute;
88
80
  z-index: 10;
89
81
  right: 0;
@@ -97,66 +89,158 @@
97
89
  }
98
90
  }
99
91
 
100
- .isCard .body,
92
+ .isRich {
93
+ color: #000;
94
+
95
+ @media $landscapeTablet {
96
+ color: #fff;
97
+ }
98
+ }
99
+
101
100
  .isRich.hasGradient .body {
101
+ @media $landscapeTablet {
102
+ position: absolute;
103
+ z-index: 10;
104
+ right: 0;
105
+ bottom: 0;
106
+ left: 0;
107
+
108
+ min-height: 295px;
109
+
110
+ background-color: transparent;
111
+ }
112
+ }
113
+
114
+ .isRich .picture {
115
+ position: relative;
116
+ }
117
+
118
+ .isRich .picture::after {
102
119
  position: absolute;
103
120
  z-index: 10;
121
+ top: 0;
104
122
  right: 0;
105
123
  bottom: 0;
106
124
  left: 0;
107
125
 
108
- min-height: 295px;
126
+ content: '';
109
127
 
110
- background-color: transparent;
128
+ border-radius: 8px 8px 0 0;
129
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
111
130
  }
112
131
 
113
132
  .isCard {
114
133
  color: #fff;
115
134
  background-color: #191919;
135
+
136
+ @media $mobile {
137
+ min-height: 350px;
138
+ }
139
+ }
140
+
141
+ .isCard .body {
142
+ background-color: transparent;
143
+
144
+ @media $mobile {
145
+ position: absolute;
146
+ z-index: 10;
147
+ right: 0;
148
+ bottom: 0;
149
+ left: 0;
150
+
151
+ min-height: 295px;
152
+ }
153
+ }
154
+
155
+ .isCard::before {
156
+ @media $mobile {
157
+ padding-bottom: 66.66%;
158
+
159
+ content: '';
160
+ }
116
161
  }
117
162
 
118
163
  .isCard .cover {
164
+ position: relative;
165
+
166
+ width: 100%;
167
+
168
+ @media $mobile {
169
+ position: absolute;
170
+ top: 0;
171
+ bottom: 0;
172
+ }
173
+ }
174
+
175
+ .isCard .cover::before {
176
+ display: block;
177
+
178
+ padding-bottom: 78.50746269%;
179
+
180
+ content: '';
181
+
182
+ @media $mobile {
183
+ content: none;
184
+ }
185
+ }
186
+
187
+ .isCard .picture {
119
188
  position: absolute;
120
- top: 17.2811059908%;
189
+ top: 50%;
121
190
  left: 50%;
122
191
 
123
- width: 170px;
192
+ width: 180px;
193
+ height: 180px;
124
194
 
125
- transform: translate(-50%, 0);
126
- }
195
+ transform: translate(-50%, -50%);
127
196
 
128
- .isRich {
129
- color: #000;
197
+ @media $mobile {
198
+ top: 25%;
130
199
 
131
- @media $landscapeTablet {
132
- color: #fff;
200
+ transform: translate(-50%, -25%);
133
201
  }
134
202
  }
135
203
 
136
204
  .tag {
137
205
  position: absolute;
138
206
  z-index: 10;
139
- top: 15px;
207
+ top: 14px;
208
+ right: 15px;
140
209
  left: 15px;
141
210
 
142
- color: #fff;
211
+ color: rgba(255, 255, 255, 0.7);
143
212
 
144
- @media $mobile {
145
- top: 20px;
213
+ font-size: 12px;
214
+
215
+ @media $landscapeTablet {
216
+ top: 16px;
217
+ right: 20px;
146
218
  left: 20px;
147
219
  }
148
220
  }
149
221
 
222
+ .center {
223
+ width: 100%;
224
+ max-width: 650px;
225
+ margin-right: auto;
226
+ margin-left: auto;
227
+ }
228
+
150
229
  /* Themes */
151
230
 
152
- .isRich.dark,
153
- .isRich.dark .tag {
231
+ .isRich.dark {
154
232
  color: #000;
155
233
  }
156
234
 
235
+ .isRich.dark .tag {
236
+ color: rgba(0, 0, 0, 0.7);
237
+ }
238
+
157
239
  .isRich.light {
158
- color: #fff;
159
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
240
+ @media $mobile {
241
+ color: #fff;
242
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
243
+ }
160
244
  }
161
245
 
162
246
  /* Display */
@@ -17,7 +17,6 @@ const Example: React.FC = () => {
17
17
  return (
18
18
  <>
19
19
  <div className={styles.root}>
20
- <div style={{ height: '1000px' }}></div>
21
20
  <div className={styles.card}>
22
21
  <RelatedRichBlock block={mock.rich} styleContext={['no_mods']} />
23
22
  </div>
@@ -37,7 +37,8 @@ export const RelatedRichBlock: React.FC<RelatedRichBlockProps> = ({
37
37
  const cardType = `is${toCapitalize(layout)}`
38
38
 
39
39
  useEffect(() => {
40
- setType(Math.random() >= 0.5 ? 'simpleRelated' : 'richRelated')
40
+ // setType(Math.random() >= 0.5 ? 'simpleRelated' : 'richRelated')
41
+ setType('richRelated')
41
42
  }, [])
42
43
 
43
44
  const [ref, inView] = useInView({
@@ -77,18 +78,21 @@ export const RelatedRichBlock: React.FC<RelatedRichBlockProps> = ({
77
78
  }
78
79
 
79
80
  if (gradients) {
80
- const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light']
81
-
82
- classNames = makeStyleContext(classNames, theme, styles)
83
-
84
81
  styleHeader.backgroundImage = generateGradient(
85
82
  gradients.bg_rgb,
86
83
  'mediaBlockTop'
87
84
  )
88
- style.backgroundImage = generateGradient(
89
- gradients.bg_rgb,
90
- 'mediaBlockBottom'
91
- )
85
+
86
+ const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light']
87
+ classNames = makeStyleContext(classNames, theme, styles)
88
+
89
+ if (onlyOn === 'desktop') {
90
+
91
+ style.backgroundImage = generateGradient(
92
+ gradients.bg_rgb,
93
+ 'mediaBlockBottom'
94
+ )
95
+ }
92
96
  }
93
97
 
94
98
  if (type === 'unset') {
@@ -107,7 +111,7 @@ export const RelatedRichBlock: React.FC<RelatedRichBlockProps> = ({
107
111
  <a
108
112
  data-testid="related-rich-block"
109
113
  className={makeClassName(classNames)}
110
- href={url}
114
+ href={`/${url}`}
111
115
  target="_blank"
112
116
  onClick={(): void => handleClick()}
113
117
  ref={ref}
@@ -120,12 +124,14 @@ export const RelatedRichBlock: React.FC<RelatedRichBlockProps> = ({
120
124
  )}
121
125
 
122
126
  <div className={styles.tag}>
123
- <Tag size="small" theme="inherit" styleContext="rich">
127
+ <Tag size="small" theme="inherit" styleContext="richRelated">
124
128
  {tag}
125
129
  </Tag>
126
130
  </div>
127
131
  <div className={styles.cover}>
128
- <Image optimized={urls} ratio={ratio} display="narrow" />
132
+ <div className={styles.picture}>
133
+ <Image optimized={urls} ratio={ratio} display="narrow" />
134
+ </div>
129
135
  </div>
130
136
  <div className={styles.body}>
131
137
  {blocks.map((item) => (
@@ -19,7 +19,7 @@
19
19
  "only_on": "mobile"
20
20
  },
21
21
  "cover": {
22
- "ratio": 1.4976958525,
22
+ "ratio": 1.5,
23
23
  "layout": "rich",
24
24
  "urls": {
25
25
  "w325": {
@@ -35,6 +35,10 @@
35
35
  "2x_webp": "http://meduza.io/impro/MbBIK4vj9YMr8INLi6GMIYF4muqHFCWV0b1rxhhM6aI/fill/0/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNi8w/ODcvNTU2L2VsYXJn/ZS9FXzN1R1dudnNz/WHpndEowNS1fUmZ3/LmpwZw.webp"
36
36
  }
37
37
  },
38
+ "gradients": {
39
+ "text_rgb": "0,0,0",
40
+ "bg_rgb": "171,209,171"
41
+ },
38
42
  "tag": "Читайте также"
39
43
  },
40
44
  "blocks": [
@@ -55,6 +59,7 @@
55
59
  "components": [
56
60
  {
57
61
  "type": "datetime",
62
+ "format": "fromNow",
58
63
  "datetime": 1600593764,
59
64
  "id": "7639a7d1455a1ca907de0fc98a22b017e23f30e7df15b0739c78418848d674b5"
60
65
  }
@@ -88,7 +93,7 @@
88
93
  "only_on": "desktop"
89
94
  },
90
95
  "cover": {
91
- "ratio": 1.4976958525,
96
+ "ratio": 1.5,
92
97
  "layout": "rich",
93
98
  "urls": {
94
99
  "w325": {
@@ -114,8 +119,8 @@
114
119
  {
115
120
  "type": "rich_title",
116
121
  "data": {
117
- "first": "2 «Если кто-нибудь видит меня и слышит, пожалуйста, распространите это видео любым способом! Чтобы я существовал!»",
118
- "second": "Автор фильма «Котлован» о том, как сделал его из обращений россиян к Путину",
122
+ "first": "На HBO вышел сериал «Я исчезну во тьме» о маньяке Джозефе Деанджело, которого не могли найти 40 лет",
123
+ "second": "Вот что мы узнали из первых эпизодов",
119
124
  "as": "h3",
120
125
  "featured": false
121
126
  },
@@ -128,6 +133,7 @@
128
133
  "components": [
129
134
  {
130
135
  "type": "datetime",
136
+ "format": "fromNow",
131
137
  "datetime": 1600593764,
132
138
  "id": "7639a7d1455a1ca907de0fc98a22b017e23f30e7df15b0739c78418848d674b5"
133
139
  }
@@ -161,7 +167,7 @@
161
167
  "only_on": "desktop"
162
168
  },
163
169
  "cover": {
164
- "ratio": 1.4976958525,
170
+ "ratio": 1.5,
165
171
  "layout": "rich",
166
172
  "urls": {
167
173
  "w325": {
@@ -201,6 +207,7 @@
201
207
  "components": [
202
208
  {
203
209
  "type": "datetime",
210
+ "format": "fromNow",
204
211
  "datetime": 1600593764,
205
212
  "id": "7639a7d1455a1ca907de0fc98a22b017e23f30e7df15b0739c78418848d674b5"
206
213
  }
@@ -274,6 +281,7 @@
274
281
  "components": [
275
282
  {
276
283
  "type": "datetime",
284
+ "format": "fromNow",
277
285
  "datetime": 1600593764,
278
286
  "id": "7639a7d1455a1ca907de0fc98a22b017e23f30e7df15b0739c78418848d674b5"
279
287
  }
@@ -340,6 +348,7 @@
340
348
  "components": [
341
349
  {
342
350
  "type": "datetime",
351
+ "format": "fromNow",
343
352
  "datetime": 1600593764,
344
353
  "id": "7639a7d1455a1ca907de0fc98a22b017e23f30e7df15b0739c78418848d674b5"
345
354
  }
@@ -85,18 +85,16 @@
85
85
  line-height: 23px;
86
86
 
87
87
  @media $landscapeTablet {
88
- font-size: 26px;
89
- line-height: 32px;
88
+ font-size: 1.3rem;
89
+ line-height: 1.6rem;
90
90
  }
91
91
  }
92
92
 
93
93
  .isInMediaBlock:not(.featured) span {
94
94
  font-size: 20px;
95
- line-height: 23px;
96
95
 
97
96
  @media $landscapeTablet {
98
- font-size: 27px;
99
- line-height: 32px;
97
+ font-size: 1.35rem;
100
98
  }
101
99
  }
102
100
 
@@ -5,6 +5,7 @@ export interface RichTitleProps {
5
5
  featured?: boolean
6
6
  first: string
7
7
  second?: string
8
+ as?: keyof JSX.IntrinsicElements
8
9
  }
9
10
  }
10
11
  styleContext?: string[] | string
@@ -8,7 +8,7 @@ import styles from './RichTitle.module.css'
8
8
  export const RichTitle: React.FC<RichTitleProps> = ({
9
9
  block: {
10
10
  only_on: onlyOn,
11
- data: { featured, first, second }
11
+ data: { featured, first, second, as: TagName = 'h1' }
12
12
  },
13
13
  styleContext
14
14
  }) => {
@@ -23,9 +23,9 @@ export const RichTitle: React.FC<RichTitleProps> = ({
23
23
  }
24
24
 
25
25
  return (
26
- <h1 data-testid="rich-title" className={makeClassName(classNames)}>
26
+ <TagName data-testid="rich-title" className={makeClassName(classNames)}>
27
27
  {first}
28
28
  {second && <span> {second}</span>}
29
- </h1>
29
+ </TagName>
30
30
  )
31
31
  }
@@ -83,6 +83,16 @@
83
83
  }
84
84
  }
85
85
 
86
+ .richRelated {
87
+ font-size: 12px;
88
+ line-height: 17px;
89
+
90
+ @media $landscapeTablet {
91
+ font-size: 14px;
92
+ line-height: 20px;
93
+ }
94
+ }
95
+
86
96
  .slide,
87
97
  .game,
88
98
  .card,
@@ -64,9 +64,21 @@
64
64
  format('woff');
65
65
  }
66
66
 
67
+ /* set font-size as website */
68
+ html {
69
+ @media (min-width: 1000px) {
70
+ font-size: calc(100vw / 66.75);
71
+ }
72
+
73
+ @media (min-width: 1335px) {
74
+ font-size: 20px;
75
+ }
76
+ }
77
+
67
78
  .root {
68
79
  color: #000;
69
80
  background: #fff;
81
+
70
82
  }
71
83
 
72
84
  .sideBySide {