@meduza/ui-kit-2 0.8.602 → 0.8.604

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.
@@ -2335,6 +2335,16 @@
2335
2335
  background-color: #4f4f4f;
2336
2336
  }
2337
2337
 
2338
+ .Meta-module_containerInDynamicBlock__YSh66 {
2339
+ position: absolute;
2340
+ bottom: 20px;
2341
+ left: 57px;
2342
+ }
2343
+
2344
+ .Meta-module_containerInDynamicBlockAndMaterial__4v4A9 {
2345
+ left: 65px;
2346
+ }
2347
+
2338
2348
  .Meta-module_root__H-Q4d {
2339
2349
  font-size: 12px;
2340
2350
 
@@ -2346,12 +2356,6 @@
2346
2356
  fill: inherit;
2347
2357
  }
2348
2358
 
2349
- .Meta-module_isInDynamicBlock__iuEI0 {
2350
- position: absolute;
2351
- bottom: 20px;
2352
- left: 54px;
2353
- }
2354
-
2355
2359
  .Meta-module_rich__dCkJK,
2356
2360
  .Meta-module_podcast__MI8gD,
2357
2361
  .Meta-module_episode__0n9CF,
package/dist/ui-kit.css CHANGED
@@ -2335,6 +2335,16 @@
2335
2335
  background-color: #4f4f4f;
2336
2336
  }
2337
2337
 
2338
+ .Meta-module_containerInDynamicBlock__YSh66 {
2339
+ position: absolute;
2340
+ bottom: 20px;
2341
+ left: 57px;
2342
+ }
2343
+
2344
+ .Meta-module_containerInDynamicBlockAndMaterial__4v4A9 {
2345
+ left: 65px;
2346
+ }
2347
+
2338
2348
  .Meta-module_root__H-Q4d {
2339
2349
  font-size: 12px;
2340
2350
 
@@ -2346,12 +2356,6 @@
2346
2356
  fill: inherit;
2347
2357
  }
2348
2358
 
2349
- .Meta-module_isInDynamicBlock__iuEI0 {
2350
- position: absolute;
2351
- bottom: 20px;
2352
- left: 54px;
2353
- }
2354
-
2355
2359
  .Meta-module_rich__dCkJK,
2356
2360
  .Meta-module_podcast__MI8gD,
2357
2361
  .Meta-module_episode__0n9CF,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.8.602",
2
+ "version": "0.8.604",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -1,3 +1,13 @@
1
+ .containerInDynamicBlock {
2
+ position: absolute;
3
+ bottom: 20px;
4
+ left: 57px;
5
+ }
6
+
7
+ .containerInDynamicBlockAndMaterial {
8
+ left: 65px;
9
+ }
10
+
1
11
  .root {
2
12
  font-size: 12px;
3
13
 
@@ -9,12 +19,6 @@
9
19
  fill: inherit;
10
20
  }
11
21
 
12
- .isInDynamicBlock {
13
- position: absolute;
14
- bottom: 20px;
15
- left: 54px;
16
- }
17
-
18
22
  .rich,
19
23
  .podcast,
20
24
  .episode,
@@ -10,6 +10,7 @@ export interface MetaContainerProps {
10
10
  bookmarkAction?: (service: CallToActions, place: string) => void
11
11
  lightBox?: () => void
12
12
  lang: 'ru' | 'en'
13
+ type?: any
13
14
  }
14
15
 
15
16
  export interface MetaProps {
@@ -18,5 +19,4 @@ export interface MetaProps {
18
19
  hasSource?: boolean
19
20
  theme?: string
20
21
  children: React.ReactNode
21
- type: string[] | string
22
22
  }
@@ -9,6 +9,7 @@ import { DocumentItemsCount } from '../DocumentItemsCount'
9
9
  import { BookmarkButton } from '../BookmarkButton'
10
10
  import { Timestamp } from '../Timestamp'
11
11
  import { SvgSymbol } from '../SvgSymbol'
12
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
12
13
 
13
14
  import { TimestampProps } from '../Timestamp/Timestamp.types'
14
15
 
@@ -24,7 +25,8 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
24
25
  block: {
25
26
  data: { components, theme }
26
27
  },
27
- styleContext
28
+ styleContext,
29
+ type
28
30
  }) => {
29
31
  const themeColor =
30
32
  styleContext && styleContext.indexOf('dark') !== -1 ? 'light' : 'unset'
@@ -41,140 +43,149 @@ export const MetaContainer: React.FC<MetaContainerProps> = ({
41
43
 
42
44
  const hasSource = !!components.find((item) => item.type === 'source_name')
43
45
 
46
+ const classNames: ClassNames = [
47
+ [styles.containerInDynamicBlock, styleContext === 'isInDynamicBlock'],
48
+ [
49
+ styles.containerInDynamicBlockAndMaterial,
50
+ styleContext === 'isInDynamicBlock' && type === 'isInMaterial'
51
+ ]
52
+ ]
53
+
44
54
  return (
45
- <Meta
46
- styleContext={context}
47
- theme={theme || themeColor}
48
- onlyOn={block.only_on}
49
- hasSource={hasSource}
50
- type={styleContext}
51
- >
52
- {components.map((component) => {
53
- switch (component.type) {
54
- case 'source_name': {
55
- return (
56
- <MetaItem hasSource={hasSource} bullets key={component.id}>
57
- <>
58
- {lang === 'ru' ? 'Источник: ' : 'Source: '}
59
- {component.url && (
60
- <a
61
- href={component.url}
62
- rel="noopener noreferrer"
63
- target="_blank"
64
- >
65
- {component.text}
66
- </a>
67
- )}
68
- {!component.url && component.text}
69
- </>
70
- </MetaItem>
71
- )
72
- }
73
- case 'duration': {
74
- if (styleContext === 'isInDynamicBlock') {
55
+ <div className={makeClassName(classNames)}>
56
+ <Meta
57
+ styleContext={context}
58
+ theme={theme || themeColor}
59
+ onlyOn={block.only_on}
60
+ hasSource={hasSource}
61
+ >
62
+ {components.map((component) => {
63
+ switch (component.type) {
64
+ case 'source_name': {
75
65
  return (
76
66
  <MetaItem hasSource={hasSource} bullets key={component.id}>
77
- {component.text}
67
+ <>
68
+ {lang === 'ru' ? 'Источник: ' : 'Source: '}
69
+ {component.url && (
70
+ <a
71
+ href={component.url}
72
+ rel="noopener noreferrer"
73
+ target="_blank"
74
+ >
75
+ {component.text}
76
+ </a>
77
+ )}
78
+ {!component.url && component.text}
79
+ </>
78
80
  </MetaItem>
79
81
  )
80
82
  }
81
- return (
82
- <MetaItem hasSource={hasSource} bullets key={component.id}>
83
- <>
84
- <SvgSymbol icon="podcast" size="small" />
85
- {component.text}
86
- </>
87
- </MetaItem>
88
- )
89
- }
90
- case 'datetime': {
91
- const format = ((component.format && toCamel(component.format)) ||
92
- 'date') as TimestampProps['type']
93
-
94
- return (
95
- <MetaItem
96
- hasSource={hasSource}
97
- bullets
98
- key={component.id}
99
- type="datetime"
100
- >
101
- <Timestamp
102
- publishedAt={component.datetime}
103
- type={
104
- styleContext === 'isInDynamicBlock'
105
- ? 'fromNow'
106
- : format || 'date'
107
- }
108
- locale={lang}
109
- />
110
- </MetaItem>
111
- )
112
- }
83
+ case 'duration': {
84
+ if (styleContext === 'isInDynamicBlock') {
85
+ return (
86
+ <MetaItem hasSource={hasSource} bullets key={component.id}>
87
+ {component.text}
88
+ </MetaItem>
89
+ )
90
+ }
91
+ return (
92
+ <MetaItem hasSource={hasSource} bullets key={component.id}>
93
+ <>
94
+ <SvgSymbol icon="podcast" size="small" />
95
+ {component.text}
96
+ </>
97
+ </MetaItem>
98
+ )
99
+ }
100
+ case 'datetime': {
101
+ const format = ((component.format && toCamel(component.format)) ||
102
+ 'date') as TimestampProps['type']
113
103
 
114
- case 'items_count': {
115
- return (
116
- <MetaItem hasSource={hasSource} bullets key={component.id}>
117
- <DocumentItemsCount
118
- items={component.count}
119
- type={isPodcast ? 'podcast' : 'card'}
120
- lang={lang}
104
+ return (
105
+ <MetaItem
106
+ hasSource={hasSource}
107
+ bullets
108
+ key={component.id}
109
+ type="datetime"
121
110
  >
122
- <SvgSymbol icon="card" size="unset" />
123
- </DocumentItemsCount>
124
- </MetaItem>
125
- )
126
- }
127
- case 'broadcast_active': {
128
- return (
129
- <MetaItem hasSource={hasSource} bullets key={component.id}>
130
- <>
131
- <MetaItemLive /> Прямой эфир
132
- </>
133
- </MetaItem>
134
- )
135
- }
136
- case 'broadcast': {
137
- return (
138
- <MetaItem hasSource={hasSource} bullets key={component.id}>
139
- <>
140
- {component.with_icon && <MetaItemLive />}
111
+ <Timestamp
112
+ publishedAt={component.datetime}
113
+ type={
114
+ styleContext === 'isInDynamicBlock'
115
+ ? 'fromNow'
116
+ : format || 'date'
117
+ }
118
+ locale={lang}
119
+ />
120
+ </MetaItem>
121
+ )
122
+ }
141
123
 
142
- {component.label}
143
- </>
144
- </MetaItem>
145
- )
146
- }
147
- case 'string': {
148
- return (
149
- <MetaItem hasSource={hasSource} bullets key={component.id}>
150
- {component.text}
151
- </MetaItem>
152
- )
153
- }
124
+ case 'items_count': {
125
+ return (
126
+ <MetaItem hasSource={hasSource} bullets key={component.id}>
127
+ <DocumentItemsCount
128
+ items={component.count}
129
+ type={isPodcast ? 'podcast' : 'card'}
130
+ lang={lang}
131
+ >
132
+ <SvgSymbol icon="card" size="unset" />
133
+ </DocumentItemsCount>
134
+ </MetaItem>
135
+ )
136
+ }
137
+ case 'broadcast_active': {
138
+ return (
139
+ <MetaItem hasSource={hasSource} bullets key={component.id}>
140
+ <>
141
+ <MetaItemLive /> Прямой эфир
142
+ </>
143
+ </MetaItem>
144
+ )
145
+ }
146
+ case 'broadcast': {
147
+ return (
148
+ <MetaItem hasSource={hasSource} bullets key={component.id}>
149
+ <>
150
+ {component.with_icon && <MetaItemLive />}
154
151
 
155
- default: {
156
- return null
152
+ {component.label}
153
+ </>
154
+ </MetaItem>
155
+ )
156
+ }
157
+ case 'string': {
158
+ return (
159
+ <MetaItem hasSource={hasSource} bullets key={component.id}>
160
+ {component.text}
161
+ </MetaItem>
162
+ )
163
+ }
164
+
165
+ default: {
166
+ return null
167
+ }
157
168
  }
158
- }
159
- })}
160
- {(isRead || isListened) && (
161
- <MetaItem
162
- hasSource={hasSource}
163
- bullets
164
- type={isListened ? 'listened' : 'read'}
165
- >
166
- <SvgSymbol icon={isListened ? 'listened' : 'read'} size="unset" />
167
- </MetaItem>
168
- )}
169
+ })}
170
+ {(isRead || isListened) && (
171
+ <MetaItem
172
+ hasSource={hasSource}
173
+ bullets
174
+ type={isListened ? 'listened' : 'read'}
175
+ >
176
+ <SvgSymbol icon={isListened ? 'listened' : 'read'} size="unset" />
177
+ </MetaItem>
178
+ )}
169
179
 
170
- {isSlides && lang === 'ru' && (
171
- <div className={styles.bookmark}>
172
- <BookmarkButton
173
- isInBookmarks={isInBookmarks}
174
- onClick={(): void => bookmarkAction('bookmark', 'top')}
175
- />
176
- </div>
177
- )}
178
- </Meta>
180
+ {isSlides && lang === 'ru' && (
181
+ <div className={styles.bookmark}>
182
+ <BookmarkButton
183
+ isInBookmarks={isInBookmarks}
184
+ onClick={(): void => bookmarkAction('bookmark', 'top')}
185
+ />
186
+ </div>
187
+ )}
188
+ </Meta>
189
+ </div>
179
190
  )
180
191
  }
@@ -10,15 +10,13 @@ export const Meta: React.FC<MetaProps> = ({
10
10
  theme,
11
11
  children,
12
12
  onlyOn,
13
- styleContext,
14
- type
13
+ styleContext
15
14
  }) => {
16
15
  let classNames: ClassNames = [
17
16
  [styles.root, true],
18
17
  [styles[theme], !!theme && !!styles[theme]],
19
18
  [styles[onlyOn], !!onlyOn],
20
- [styles.hasSource, hasSource],
21
- [styles.isInDynamicBlock, type === 'isInDynamicBlock']
19
+ [styles.hasSource, hasSource]
22
20
  ]
23
21
 
24
22
  if (styleContext) {
@@ -17,4 +17,5 @@ export interface RawHtmlBlockProps {
17
17
  bookmarkAction?: (service: CallToActions, place: string) => void
18
18
  lightBox?: LightboxContext | null | undefined
19
19
  lang?: 'ru' | 'en'
20
+ type?: any
20
21
  }
@@ -18,7 +18,8 @@ export const RawHtmlBlock: React.FC<RawHtmlBlockProps> = ({
18
18
  isInBookmarks,
19
19
  bookmarkAction,
20
20
  lightBox,
21
- lang
21
+ lang,
22
+ type = 'default'
22
23
  }) => {
23
24
  const context = {
24
25
  lightBox: lightBox || null
@@ -68,6 +69,7 @@ export const RawHtmlBlock: React.FC<RawHtmlBlockProps> = ({
68
69
  isInBookmarks={isInBookmarks}
69
70
  bookmarkAction={bookmarkAction}
70
71
  lang={lang}
72
+ type={type}
71
73
  />
72
74
  </BlockProvider>
73
75
  )
@@ -10,4 +10,5 @@ export interface RenderBlocksProps {
10
10
  bookmarkAction?: (service: CallToActions, place: string) => void
11
11
  lightBox?: LightboxContext | null | undefined
12
12
  lang?: 'ru' | 'en'
13
+ type?: any
13
14
  }
@@ -27,7 +27,8 @@ export const RenderBlocks: React.FC<RenderBlocksProps> = ({
27
27
  isRead,
28
28
  isListened,
29
29
  bookmarkAction,
30
- isInBookmarks
30
+ isInBookmarks,
31
+ type = 'default'
31
32
  }) => {
32
33
  switch (block.type) {
33
34
  case 'tag': {
@@ -61,6 +62,7 @@ export const RenderBlocks: React.FC<RenderBlocksProps> = ({
61
62
  isListened={isListened}
62
63
  isInBookmarks={isInBookmarks}
63
64
  bookmarkAction={bookmarkAction}
65
+ type={type}
64
66
  />
65
67
  )
66
68
  }