@meduza/ui-kit-2 0.4.14 → 0.5.1

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.
Files changed (160) hide show
  1. package/package.json +7 -1
  2. package/src/Cover/index.tsx +2 -10
  3. package/src/DocumentItemsCount/DocumentItemsCount.module.css +12 -1
  4. package/src/DocumentItemsCount/DocumentItemsCount.test.tsx +9 -2
  5. package/src/DocumentItemsCount/index.tsx +3 -3
  6. package/src/Image/Image.module.css +0 -11
  7. package/src/Meta/Meta.module.css +0 -5
  8. package/src/Meta/Meta.stories.module.css +0 -16
  9. package/src/Meta/Meta.stories.tsx +4 -51
  10. package/src/Meta/MetaContainer.tsx +0 -8
  11. package/src/RawHtmlBlock/index.tsx +5 -0
  12. package/src/RelatedRichBlock/RelatedRichBlock.module.css +1 -11
  13. package/src/RenderBlocks/index.tsx +1 -5
  14. package/src/ShopRelatedBlock/ShopRelatedBlock.module.css +210 -0
  15. package/src/ShopRelatedBlock/ShopRelatedBlock.stories.module.css +12 -0
  16. package/src/ShopRelatedBlock/ShopRelatedBlock.stories.tsx +52 -0
  17. package/src/ShopRelatedBlock/ShopRelatedBlock.test.tsx +20 -0
  18. package/src/ShopRelatedBlock/ShopRelatedBlock.types.ts +4 -0
  19. package/src/ShopRelatedBlock/index.tsx +120 -0
  20. package/src/ShopRelatedBlock/mock.json +153 -0
  21. package/src/SimpleBlock/SimpleBlock.types.ts +1 -0
  22. package/src/SimpleBlock/index.tsx +3 -1
  23. package/src/Tag/Tag.module.css +3 -8
  24. package/src/Tag/Tag.stories.tsx +3 -16
  25. package/src/Tag/Tag.types.ts +1 -7
  26. package/src/index.tsx +1 -1
  27. package/dist/AnnouncementInText/AnnouncementInText.types.d.ts +0 -4
  28. package/dist/AnnouncementInText/index.d.ts +0 -3
  29. package/dist/BookmarkButton/BookmarkButton.types.d.ts +0 -6
  30. package/dist/BookmarkButton/index.d.ts +0 -3
  31. package/dist/Button/Button.d.ts +0 -3
  32. package/dist/Button/Button.types.d.ts +0 -16
  33. package/dist/Button/ButtonLoader.d.ts +0 -2
  34. package/dist/Button/index.d.ts +0 -2
  35. package/dist/CardTitle/CardTitle.types.d.ts +0 -10
  36. package/dist/CardTitle/index.d.ts +0 -3
  37. package/dist/ChapterBlock/ChapterBlock.types.d.ts +0 -7
  38. package/dist/ChapterBlock/index.d.ts +0 -3
  39. package/dist/Cover/Cover.types.d.ts +0 -24
  40. package/dist/Cover/index.d.ts +0 -3
  41. package/dist/DocumentItemsCount/DocumentItemsCount.types.d.ts +0 -7
  42. package/dist/DocumentItemsCount/index.d.ts +0 -3
  43. package/dist/DonatesTeaser/DonatesTeaser.types.d.ts +0 -4
  44. package/dist/DonatesTeaser/index.d.ts +0 -3
  45. package/dist/DotsOnImage/DotsOnImage.types.d.ts +0 -46
  46. package/dist/DotsOnImage/index.d.ts +0 -3
  47. package/dist/Dropdown/Dropdown.types.d.ts +0 -6
  48. package/dist/Dropdown/index.d.ts +0 -4
  49. package/dist/EmbedBlock/EmbedBlock.d.ts +0 -3
  50. package/dist/EmbedBlock/EmbedBlock.types.d.ts +0 -12
  51. package/dist/EmbedBlock/EmbedGif.d.ts +0 -3
  52. package/dist/EmbedBlock/IframeBlock.d.ts +0 -3
  53. package/dist/EmbedBlock/index.d.ts +0 -3
  54. package/dist/Footnote/Footnote.types.d.ts +0 -5
  55. package/dist/Footnote/index.d.ts +0 -3
  56. package/dist/GroupedBlock/GroupedBlock.types.d.ts +0 -4
  57. package/dist/GroupedBlock/index.d.ts +0 -3
  58. package/dist/HalfBlock/HalfBlock.types.d.ts +0 -4
  59. package/dist/HalfBlock/index.d.ts +0 -3
  60. package/dist/Image/Image.types.d.ts +0 -35
  61. package/dist/Image/RenderPicture.d.ts +0 -4
  62. package/dist/Image/index.d.ts +0 -3
  63. package/dist/ImportantLead/ImportantLead.types.d.ts +0 -4
  64. package/dist/ImportantLead/index.d.ts +0 -3
  65. package/dist/Lazy/Lazy.types.d.ts +0 -5
  66. package/dist/Lazy/index.d.ts +0 -3
  67. package/dist/ListBlock/ListBlock.types.d.ts +0 -10
  68. package/dist/ListBlock/index.d.ts +0 -3
  69. package/dist/MaterialNote/MaterialNote.types.d.ts +0 -13
  70. package/dist/MaterialNote/index.d.ts +0 -3
  71. package/dist/MaterialTitle/MaterialTitle.types.d.ts +0 -4
  72. package/dist/MaterialTitle/index.d.ts +0 -5
  73. package/dist/MediaCaption/MediaCaption.types.d.ts +0 -5
  74. package/dist/MediaCaption/index.d.ts +0 -3
  75. package/dist/Meta/Meta.mock.d.ts +0 -12
  76. package/dist/Meta/Meta.types.d.ts +0 -19
  77. package/dist/Meta/MetaContainer.d.ts +0 -3
  78. package/dist/Meta/index.d.ts +0 -3
  79. package/dist/MetaItem/MetaItem.types.d.ts +0 -7
  80. package/dist/MetaItem/index.d.ts +0 -3
  81. package/dist/MetaItemLive/MetaItemLive.types.d.ts +0 -3
  82. package/dist/MetaItemLive/index.d.ts +0 -3
  83. package/dist/Popover/Popover.types.d.ts +0 -5
  84. package/dist/Popover/index.d.ts +0 -3
  85. package/dist/QuoteBlock/QuoteBlock.types.d.ts +0 -6
  86. package/dist/QuoteBlock/index.d.ts +0 -3
  87. package/dist/RawHtmlBlock/RawHtmlBlock.types.d.ts +0 -17
  88. package/dist/RawHtmlBlock/index.d.ts +0 -3
  89. package/dist/RelatedBlock/RelatedBlock.types.d.ts +0 -17
  90. package/dist/RelatedBlock/index.d.ts +0 -3
  91. package/dist/RelatedBook/RelatedBook.mock.d.ts +0 -65
  92. package/dist/RelatedBook/RelatedBook.types.d.ts +0 -4
  93. package/dist/RelatedBook/index.d.ts +0 -3
  94. package/dist/RelatedRichBlock/RelatedRichBlock.types.d.ts +0 -4
  95. package/dist/RelatedRichBlock/index.d.ts +0 -3
  96. package/dist/RenderBlocks/RenderBlocks.types.d.ts +0 -11
  97. package/dist/RenderBlocks/index.d.ts +0 -3
  98. package/dist/RichTitle/RichTitle.types.d.ts +0 -13
  99. package/dist/RichTitle/index.d.ts +0 -3
  100. package/dist/SensitiveBlock/SensitiveBlock.types.d.ts +0 -15
  101. package/dist/SensitiveBlock/index.d.ts +0 -3
  102. package/dist/SimpleBlock/SimpleBlock.types.d.ts +0 -4
  103. package/dist/SimpleBlock/index.d.ts +0 -3
  104. package/dist/SimpleTitle/SimpleTitle.types.d.ts +0 -9
  105. package/dist/SimpleTitle/index.d.ts +0 -3
  106. package/dist/SourceBlock/SourceBlock.types.d.ts +0 -15
  107. package/dist/SourceBlock/index.d.ts +0 -3
  108. package/dist/Spoiler/Spoiler.types.d.ts +0 -4
  109. package/dist/Spoiler/index.d.ts +0 -3
  110. package/dist/SvgSymbol/SvgSymbol.types.d.ts +0 -8
  111. package/dist/SvgSymbol/icons.d.ts +0 -167
  112. package/dist/SvgSymbol/index.d.ts +0 -3
  113. package/dist/Switcher/Switcher.types.d.ts +0 -12
  114. package/dist/Switcher/index.d.ts +0 -3
  115. package/dist/Table/Table.types.d.ts +0 -25
  116. package/dist/Table/index.d.ts +0 -3
  117. package/dist/Tag/Tag.types.d.ts +0 -12
  118. package/dist/Tag/index.d.ts +0 -3
  119. package/dist/Timestamp/Timestamp.types.d.ts +0 -5
  120. package/dist/Timestamp/index.d.ts +0 -4
  121. package/dist/Toolbar/Toolbar.d.ts +0 -3
  122. package/dist/Toolbar/Toolbar.types.d.ts +0 -8
  123. package/dist/Toolbar/ToolbarItem.d.ts +0 -3
  124. package/dist/Toolbar/index.d.ts +0 -2
  125. package/dist/ToolbarButton/ToolbarButton.types.d.ts +0 -10
  126. package/dist/ToolbarButton/index.d.ts +0 -3
  127. package/dist/Tooltip/Tooltip.d.ts +0 -3
  128. package/dist/Tooltip/Tooltip.types.d.ts +0 -8
  129. package/dist/Tooltip/TooltipFooter.d.ts +0 -3
  130. package/dist/Tooltip/index.d.ts +0 -2
  131. package/dist/constants.d.ts +0 -41
  132. package/dist/index.d.ts +0 -45
  133. package/dist/types.d.ts +0 -20
  134. package/dist/ui-kit-2.cjs.development.js +0 -2669
  135. package/dist/ui-kit-2.cjs.development.js.map +0 -1
  136. package/dist/ui-kit-2.cjs.production.min.js +0 -2
  137. package/dist/ui-kit-2.cjs.production.min.js.map +0 -1
  138. package/dist/ui-kit-2.esm.js +0 -2615
  139. package/dist/ui-kit-2.esm.js.map +0 -1
  140. package/dist/ui-kit.css +0 -6006
  141. package/dist/utils/BlockContext.d.ts +0 -8
  142. package/dist/utils/DangerousHtml.d.ts +0 -8
  143. package/dist/utils/capitalizeFirstLetter.d.ts +0 -1
  144. package/dist/utils/converCase.d.ts +0 -2
  145. package/dist/utils/generateGradient.d.ts +0 -2
  146. package/dist/utils/getElementPositionRelativeToViewport.d.ts +0 -2
  147. package/dist/utils/makeClassName.d.ts +0 -3
  148. package/dist/utils/makeStyleContext.d.ts +0 -3
  149. package/dist/utils/pluralize.d.ts +0 -2
  150. package/dist/utils/postMessage.d.ts +0 -2
  151. package/dist/utils/viewportSize.d.ts +0 -6
  152. package/src/.DS_Store +0 -0
  153. package/src/Meta/Meta.mock.ts +0 -19
  154. package/src/RelatedBook/RelatedBook.mock.ts +0 -68
  155. package/src/RelatedBook/RelatedBook.module.css +0 -210
  156. package/src/RelatedBook/RelatedBook.stories.module.css +0 -5
  157. package/src/RelatedBook/RelatedBook.stories.tsx +0 -35
  158. package/src/RelatedBook/RelatedBook.test.tsx +0 -20
  159. package/src/RelatedBook/RelatedBook.types.ts +0 -4
  160. package/src/RelatedBook/index.tsx +0 -68
@@ -0,0 +1,120 @@
1
+ /* eslint-disable react/jsx-no-target-blank */
2
+ import React, { useEffect } from 'react'
3
+
4
+ import { useInView } from 'react-intersection-observer'
5
+ import { ShopRelatedBlockProps } from './ShopRelatedBlock.types'
6
+
7
+ import postMessage from '../utils/postMessage'
8
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
9
+ import makeStyleContext from '../utils/makeStyleContext'
10
+ import generateGradient from '../utils/generateGradient'
11
+
12
+ import { Tag } from '../Tag'
13
+ import { Image } from '../Image'
14
+
15
+ import styles from './ShopRelatedBlock.module.css'
16
+
17
+ export const ShopRelatedBlock: React.FC<ShopRelatedBlockProps> = ({
18
+ block: {
19
+ only_on: onlyOn,
20
+ data: {
21
+ url,
22
+ cover: {
23
+ urls,
24
+ gradients,
25
+ tag,
26
+ layout,
27
+ ratio,
28
+ first_title: firstTitle,
29
+ second_title: secondTitle
30
+ }
31
+ }
32
+ },
33
+ styleContext
34
+ }) => {
35
+ const style: React.CSSProperties = {}
36
+ const styleHeader: React.CSSProperties = {}
37
+
38
+ const [ref, inView] = useInView({
39
+ threshold: 0,
40
+ triggerOnce: true
41
+ })
42
+
43
+ useEffect(() => {
44
+ if (inView) {
45
+ if (
46
+ (onlyOn === 'mobile' && window.innerWidth <= 511) ||
47
+ (onlyOn === 'desktop' && window.innerWidth >= 512) ||
48
+ !onlyOn
49
+ ) {
50
+ postMessage('productRelated', url, 'view')
51
+ }
52
+ }
53
+ }, [inView])
54
+
55
+ const handleClick = () => {
56
+ postMessage('productRelated', url, 'click')
57
+ }
58
+
59
+ let classNames: ClassNames = [
60
+ [styles.root, true],
61
+ [styles.hasGradient, !!gradients],
62
+ [styles[onlyOn], !!onlyOn && !!styles[onlyOn]]
63
+ ]
64
+
65
+ if (styleContext) {
66
+ classNames = makeStyleContext(classNames, styleContext, styles)
67
+ }
68
+
69
+ if (gradients) {
70
+ styleHeader.backgroundImage = generateGradient(
71
+ gradients.bg_rgb,
72
+ 'mediaBlockTop'
73
+ )
74
+
75
+ const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light']
76
+ classNames = makeStyleContext(classNames, theme, styles)
77
+
78
+ if (onlyOn === 'desktop') {
79
+ style.backgroundImage = generateGradient(
80
+ gradients.bg_rgb,
81
+ 'mediaBlockBottom'
82
+ )
83
+ }
84
+ }
85
+
86
+ return (
87
+ <a
88
+ data-testid="related-rich-block"
89
+ className={makeClassName(classNames)}
90
+ href={url}
91
+ target="_blank"
92
+ onClick={(): void => handleClick()}
93
+ ref={ref}
94
+ >
95
+ {layout === 'rich' && (
96
+ <>
97
+ <div className={styles.overlay} style={style} />
98
+ <div className={styles.overlayHeader} style={styleHeader} />
99
+ </>
100
+ )}
101
+
102
+ <div className={styles.tag}>
103
+ <Tag size="small" theme="inherit" styleContext="richRelated">
104
+ {tag}
105
+ </Tag>
106
+ </div>
107
+ <div className={styles.cover}>
108
+ <div className={styles.picture}>
109
+ <Image optimized={urls} ratio={ratio} display="narrow" />
110
+ </div>
111
+ </div>
112
+ <div className={styles.body}>
113
+ <h2 className={styles.title}>
114
+ {firstTitle}
115
+ <span className={styles.price}>{secondTitle}</span>
116
+ </h2>
117
+ </div>
118
+ </a>
119
+ )
120
+ }
@@ -0,0 +1,153 @@
1
+ {
2
+ "rich": {
3
+ "type": "related_shop",
4
+ "data": {
5
+ "url": "https://meduza.io/",
6
+
7
+ "cover": {
8
+ "ratio": 1.5,
9
+ "layout": "rich",
10
+ "urls": {
11
+ "w325": {
12
+ "1x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
13
+ "2x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
14
+ "1x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
15
+ "2x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg"
16
+ },
17
+ "w600": {
18
+ "1x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
19
+ "2x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
20
+ "1x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
21
+ "2x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg"
22
+ }
23
+ },
24
+ "gradients": {
25
+ "text_rgb": "0,0,0",
26
+ "bg_rgb": "214, 216, 207"
27
+ },
28
+ "tag": "Можно купить",
29
+ "first_title": "Шторка для камеры",
30
+ "second_title": "500р."
31
+ }
32
+ },
33
+ "only_on": "mobile"
34
+ },
35
+
36
+ "rich_dark": {
37
+ "type": "related_rich",
38
+ "data": {
39
+ "url": "https://meduza.io/",
40
+ "fallback": {
41
+ "data": {
42
+ "title": "Не богато вышло",
43
+ "related": [
44
+ {
45
+ "title": "«Если кто-нибудь видит меня и слышит, пожалуйста, распространите это видео любым способом! Чтобы я существовал!»",
46
+ "second": "Автор фильма «Котлован» — о том, как сделал его из обращений россиян к Путину",
47
+ "layout": "rich",
48
+ "url": "feature/2018/09/18/na-rossiyskuyu-bolnitsu-pervye-podali-v-sud-za-otkaz-v-poseschenii-umirayuschego-v-reanimatsii-rodstvennika-sud-vstal-na-storonu-medikov",
49
+ "id": "0-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
50
+ }
51
+ ]
52
+ },
53
+ "only_on": "desktop"
54
+ },
55
+ "cover": {
56
+ "ratio": 1.5,
57
+ "layout": "rich",
58
+ "urls": {
59
+ "w325": {
60
+ "1x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
61
+ "2x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
62
+ "1x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
63
+ "2x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg"
64
+ },
65
+ "w600": {
66
+ "1x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
67
+ "2x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
68
+ "1x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
69
+ "2x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg"
70
+ }
71
+ },
72
+ "first_title": "Шторка для камеры",
73
+ "second_title": "500р.",
74
+
75
+ "tag": "Можно купить",
76
+ "gradients": {
77
+ "text_rgb": "255,255,255",
78
+ "bg_rgb": "0,0,0"
79
+ }
80
+ }
81
+ },
82
+ "only_on": "desktop"
83
+ },
84
+
85
+ "rich_and_featured_desktop": {
86
+ "type": "related_rich",
87
+ "data": {
88
+ "url": "https://meduza.io/",
89
+
90
+ "cover": {
91
+ "ratio": 1.5,
92
+ "layout": "rich",
93
+ "urls": {
94
+ "w325": {
95
+ "1x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
96
+ "2x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
97
+ "1x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
98
+ "2x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg"
99
+ },
100
+ "w600": {
101
+ "1x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
102
+ "2x": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
103
+ "1x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg",
104
+ "2x_webp": "//meduza.io/image/attachments/images/006/942/207/original/SvVDNHQAimcm6VGxS21y1A.jpg"
105
+ }
106
+ },
107
+ "first_title": "Шторка для камеры",
108
+ "second_title": "500р.",
109
+
110
+ "tag": "Можно купить",
111
+ "gradients": {
112
+ "text_rgb": "0,0,0",
113
+ "bg_rgb": "214, 216, 207"
114
+ }
115
+ }
116
+ },
117
+ "only_on": "desktop"
118
+ },
119
+
120
+ "rich_and_featured_mobile": {
121
+ "type": "related_rich",
122
+ "data": {
123
+ "url": "https://meduza.io/",
124
+
125
+ "cover": {
126
+ "ratio": 0.63,
127
+ "layout": "rich",
128
+ "urls": {
129
+ "w325": {
130
+ "1x": "http://meduza.io/impro/YW9jtqBkQc7dgyPKdgtvS8JlSvPyIgY7p-7-9C49csw/fill/325/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.jpg",
131
+ "2x": "http://meduza.io/impro/jQf0sx4Df9y23YQ0HKyGauLGYB6kMxQ_jR2QExB4_Q0/fill/650/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.jpg",
132
+ "1x_webp": "http://meduza.io/impro/dROSpimx8lYjBAbaWxhjPzPggOoz_RxV8useloSPgbQ/fill/325/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.webp",
133
+ "2x_webp": "http://meduza.io/impro/dgkov3ooEbjTSe1sUvY-NLVUr6y56Dbmtpke_g-i65c/fill/650/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.webp"
134
+ },
135
+ "w600": {
136
+ "1x": "http://meduza.io/impro/03bNGjN3Exb5vIT4jm4-VouBTahiFgH9gF8MhGd5hdw/fill/600/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.jpg",
137
+ "2x": "http://meduza.io/impro/k7qCc2LDxE-qv6L2P5LBGo-Qmdlm68WxC2OIi6yg_SY/fill/1200/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.jpg",
138
+ "1x_webp": "http://meduza.io/impro/4So4ZS9GWd3WTs4fUY7Lbk4CiKkoPhUQiigwXxZVGo0/fill/600/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.webp",
139
+ "2x_webp": "http://meduza.io/impro/VZ5TtAH8GN9hENkyuoPhG7TvCLemOhHf1fgJKG9i5T4/fill/1200/0/ce/1/aHR0cHM6Ly9tZWR1/emEuaW8vaW1hZ2Uv/YXR0YWNobWVudHMv/aW1hZ2VzLzAwNC81/NDMvOTE4L29yaWdp/bmFsLzRDeHQwdFR5/YWhlUGhnZHd4YVBz/R1EuanBn.webp"
140
+ }
141
+ },
142
+ "tag": "Можно купить",
143
+ "gradients": {
144
+ "text_rgb": "255,255,255",
145
+ "bg_rgb": "0,0,0"
146
+ },
147
+ "first_title": "Шторка для камеры",
148
+ "second_title": "500р."
149
+ }
150
+ },
151
+ "only_on": "mobile"
152
+ }
153
+ }
@@ -1,4 +1,5 @@
1
1
  export interface SimpleBlockProps {
2
2
  block: any
3
3
  styleContext?: string[] | string
4
+ id?: string
4
5
  }
@@ -7,7 +7,8 @@ import styles from './SimpleBlock.module.css'
7
7
 
8
8
  export const SimpleBlock: React.FC<SimpleBlockProps> = ({
9
9
  block: { data, type, only_on: onlyOn },
10
- styleContext
10
+ styleContext,
11
+ id
11
12
  }) => {
12
13
  let TagName
13
14
 
@@ -42,6 +43,7 @@ export const SimpleBlock: React.FC<SimpleBlockProps> = ({
42
43
  <TagName
43
44
  className={makeClassName(classNames)}
44
45
  dangerouslySetInnerHTML={{ __html: data }}
46
+ id={id}
45
47
  />
46
48
  )
47
49
  }
@@ -28,6 +28,7 @@
28
28
 
29
29
  .large {
30
30
  @media $landscapeTablet {
31
+
31
32
  font-size: 14px;
32
33
  line-height: 16px;
33
34
  letter-spacing: 1px;
@@ -54,14 +55,11 @@
54
55
  color: inherit;
55
56
  }
56
57
 
57
- .custom {
58
- color: var(--tagColor);
59
- }
60
-
61
58
  .is1to1,
62
59
  .is1to2,
63
60
  .isInSuperBlock {
64
61
  @media $landscapeTablet {
62
+
65
63
  font-size: 12px;
66
64
  line-height: 20px;
67
65
  letter-spacing: 1px;
@@ -71,6 +69,7 @@
71
69
  .is1to3,
72
70
  .is1to4 {
73
71
  @media $landscapeTablet {
72
+
74
73
  font-size: 10px;
75
74
  line-height: 15px;
76
75
  letter-spacing: 0.5px;
@@ -132,7 +131,3 @@
132
131
  display: block;
133
132
  }
134
133
  }
135
-
136
- .isInBookRelated {
137
- margin-bottom: 6px;
138
- }
@@ -14,34 +14,21 @@ export default {
14
14
  }
15
15
 
16
16
  const Example: React.FC = () => {
17
- const tags: {
18
- theme: TagThemes
19
- size: TagSizes
20
- title: string
21
- color?: string
22
- }[] = [
17
+ const tags: { theme: TagThemes; size: TagSizes; title: string }[] = [
23
18
  { theme: 'dark', size: 'small', title: 'Новости' },
24
19
  { theme: 'gold', size: 'small', title: 'Новости' },
25
20
  { theme: 'gray', size: 'small', title: 'Новости' },
26
21
  { theme: 'light', size: 'small', title: 'Новости' },
27
- { theme: 'custom', size: 'small', title: 'Новости', color: '250,0,255' },
28
22
  { theme: 'dark', size: 'large', title: 'Новости' },
29
23
  { theme: 'gold', size: 'large', title: 'Новости' },
30
24
  { theme: 'gray', size: 'large', title: 'Новости' },
31
- { theme: 'light', size: 'large', title: 'Новости' },
32
- { theme: 'custom', size: 'large', title: 'Новости', color: '250,0,255' }
25
+ { theme: 'light', size: 'large', title: 'Новости' }
33
26
  ]
34
27
  return (
35
28
  <>
36
29
  <div className={styles.root}>
37
30
  {tags.map((tag) => (
38
- <div
39
- key={`tagSize-${tag.theme}-${tag.size}`}
40
- style={
41
- tag.color &&
42
- ({ '--tagColor': `rgb(${tag.color})` } as React.CSSProperties)
43
- }
44
- >
31
+ <div key={`tagSize-${tag.theme}-${tag.size}`}>
45
32
  <Tag size={tag.size} theme={tag.theme} styleContext="rich">
46
33
  {tag.title}
47
34
  </Tag>
@@ -2,13 +2,7 @@ import React from 'react'
2
2
 
3
3
  export type TagSizes = 'small' | 'large'
4
4
 
5
- export type TagThemes =
6
- | 'dark'
7
- | 'gold'
8
- | 'gray'
9
- | 'light'
10
- | 'custom'
11
- | 'inherit'
5
+ export type TagThemes = 'dark' | 'gold' | 'gray' | 'light' | 'inherit'
12
6
 
13
7
  export type TagStyleContexts = 'isInToolbar' | 'isInSpoiler' | 'isInDropdown'
14
8
 
package/src/index.tsx CHANGED
@@ -40,7 +40,7 @@ export * from './Footnote'
40
40
  export * from './RelatedRichBlock'
41
41
  export * from './SensitiveBlock'
42
42
  export * from './DonatesTeaser'
43
+ export * from './ShopRelatedBlock'
43
44
  export * from './AnnouncementInText'
44
45
  export * from './Tooltip'
45
- export * from './RelatedBook'
46
46
  // /* PLOP_INJECT_LINK */ //
@@ -1,4 +0,0 @@
1
- export interface AnnouncementInTextProps {
2
- styleContext: string[] | string;
3
- lang: 'ru' | 'en';
4
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { AnnouncementInTextProps } from './AnnouncementInText.types';
3
- export declare const AnnouncementInText: React.FC<AnnouncementInTextProps>;
@@ -1,6 +0,0 @@
1
- export interface BookmarkButtonProps {
2
- styleContext?: string | string[];
3
- theme?: string;
4
- isInBookmarks: boolean;
5
- onClick: () => void;
6
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { BookmarkButtonProps } from './BookmarkButton.types';
3
- export declare const BookmarkButton: React.FC<BookmarkButtonProps>;
@@ -1,3 +0,0 @@
1
- import { FC } from 'react';
2
- import { ButtonProps } from './Button.types';
3
- export declare const Button: FC<ButtonProps>;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- export type ButtonThemes = 'sand' | 'gold' | 'light' | 'gray' | 'ghost' | 'dark' | 'black' | 'red';
3
- export type ButtonStates = 'isLoading' | 'isDefault';
4
- export type ButtonSizes = 'auto' | 'default';
5
- export type ButtonStyleContexts = 'isInToolbar' | 'isInSpoiler' | 'isInDropdown';
6
- export type ButtonAppearance = 'isFancy' | 'isClassic';
7
- export interface ButtonProps {
8
- theme?: ButtonThemes;
9
- appearance?: ButtonAppearance;
10
- size?: ButtonSizes;
11
- state?: ButtonStates;
12
- styleContext?: ButtonStyleContexts;
13
- disabled?: boolean;
14
- onClick?: () => void;
15
- children: React.ReactNode | JSX.Element[] | JSX.Element;
16
- }
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const ButtonLoader: React.FC;
@@ -1,2 +0,0 @@
1
- export { Button } from './Button';
2
- export { ButtonLoader } from './ButtonLoader';
@@ -1,10 +0,0 @@
1
- export interface CardTitleProps {
2
- block: {
3
- data: {
4
- index: number;
5
- text: string;
6
- only_on?: string;
7
- };
8
- };
9
- styleContext?: string;
10
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { CardTitleProps } from './CardTitle.types';
3
- export declare const CardTitle: React.FC<CardTitleProps>;
@@ -1,7 +0,0 @@
1
- export interface ChapterBlockProps {
2
- block: {
3
- data: string;
4
- only_on?: string;
5
- };
6
- styleContext?: string;
7
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { ChapterBlockProps } from './ChapterBlock.types';
3
- export declare const ChapterBlock: React.FC<ChapterBlockProps>;
@@ -1,24 +0,0 @@
1
- import { OptimizedImageItem } from '../types';
2
- export interface CoverProps {
3
- block: {
4
- only_on?: string;
5
- data: {
6
- blocks: any;
7
- cover: {
8
- credit?: string;
9
- caption?: string;
10
- cc: string;
11
- urls: {
12
- w325: OptimizedImageItem;
13
- w600: OptimizedImageItem;
14
- };
15
- mobile_ratio: number;
16
- gradients: {
17
- text_rgb: string;
18
- bg_rgb: string;
19
- };
20
- };
21
- };
22
- };
23
- styleContext?: string[] | string;
24
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { CoverProps } from './Cover.types';
3
- export declare const Cover: React.FC<CoverProps>;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- export interface DocumentItemsCountProps {
3
- type: 'podcast' | 'card';
4
- lang?: 'ru' | 'en';
5
- items: number;
6
- children?: JSX.Element[] | JSX.Element;
7
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { DocumentItemsCountProps } from './DocumentItemsCount.types';
3
- export declare const DocumentItemsCount: React.FC<DocumentItemsCountProps>;
@@ -1,4 +0,0 @@
1
- export interface DonatesTeaserProps {
2
- styleContext: string[] | string;
3
- lang: 'ru' | 'en';
4
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { DonatesTeaserProps } from './DonatesTeaser.types';
3
- export declare const DonatesTeaser: React.FC<DonatesTeaserProps>;
@@ -1,46 +0,0 @@
1
- /// <reference types="react" />
2
- import { OptimizedImageItem } from '../types';
3
- export interface PopoverData {
4
- title?: string;
5
- body?: string;
6
- id?: string;
7
- align?: 'isTop' | 'isBottom';
8
- side?: 'isLeft' | 'isRight';
9
- style?: React.CSSProperties;
10
- show: boolean;
11
- }
12
- export interface SingleDot {
13
- title?: string;
14
- body: string;
15
- id: string;
16
- position: {
17
- x: number;
18
- y: number;
19
- };
20
- icon: {
21
- type: string;
22
- number?: string;
23
- svg_string?: string;
24
- color: string;
25
- };
26
- }
27
- export interface DotsOnImageProps {
28
- block: {
29
- credit?: string;
30
- caption?: string;
31
- cc?: string;
32
- display?: string;
33
- optimized?: {
34
- original?: string;
35
- w325: OptimizedImageItem;
36
- w520?: OptimizedImageItem;
37
- w650?: OptimizedImageItem;
38
- w980?: OptimizedImageItem;
39
- w1335?: OptimizedImageItem;
40
- };
41
- width?: number;
42
- height?: number;
43
- lazy?: boolean;
44
- dots: SingleDot[];
45
- };
46
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { DotsOnImageProps } from './DotsOnImage.types';
3
- export declare const DotsOnImage: React.FC<DotsOnImageProps>;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- export interface DropdownProps {
3
- children: JSX.Element[] | JSX.Element;
4
- active?: boolean;
5
- styleContext?: string | string[];
6
- }
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { DropdownProps } from './Dropdown.types';
3
- export declare const Menu: React.FC<DropdownProps>;
4
- export declare const Dropdown: React.FC<DropdownProps>;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { EmbedBlockProps } from './EmbedBlock.types';
3
- export declare const EmbedBlock: React.FC<EmbedBlockProps>;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- export interface EmbedGifProps {
3
- gif: string;
4
- mp4Url: string;
5
- style: React.CSSProperties;
6
- }
7
- export interface EmbedBlockProps {
8
- block: any;
9
- styleContext?: string[] | string;
10
- lang?: 'ru' | 'en';
11
- children?: React.ReactNode;
12
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { EmbedGifProps } from './EmbedBlock.types';
3
- export declare const EmbedGif: React.FC<EmbedGifProps>;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { EmbedBlockProps } from './EmbedBlock.types';
3
- export declare const IframeBlock: React.FC<EmbedBlockProps>;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { EmbedBlockProps } from './EmbedBlock.types';
3
- export declare const EmbedBlockContainer: React.FC<EmbedBlockProps>;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export interface FootnoteProps {
3
- children: React.ReactNode | JSX.Element[] | JSX.Element;
4
- onClose: () => void;
5
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { FootnoteProps } from './Footnote.types';
3
- export declare const Footnote: React.FC<FootnoteProps>;