@redneckz/wildless-cms-uni-blocks 0.3.76 → 0.3.78
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +12 -14
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Accordion/AccordionContent.d.ts +6 -3
- package/dist/components/Bonus/Bonus.js +1 -1
- package/dist/components/Bonus/Bonus.js.map +1 -1
- package/dist/components/Bonus/BonusContent.d.ts +1 -1
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +5 -5
- package/dist/components/Calculator/Calculator.js +1 -1
- package/dist/components/Calculator/Calculator.js.map +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +5 -3
- package/dist/components/GracePeriod/GracePeriod.js +2 -2
- package/dist/components/GracePeriod/GracePeriod.js.map +1 -1
- package/dist/components/GracePeriod/GracePeriodContent.d.ts +2 -2
- package/dist/components/GroupBlock/GroupBlockContent.d.ts +2 -2
- package/dist/components/GroupBlock/GroupBlockTabs.js +1 -1
- package/dist/components/GroupBlock/GroupBlockTabs.js.map +1 -1
- package/dist/components/LinkDocs/LinkDocsContent.d.ts +10 -1
- package/dist/components/PictureText/PictureTextContent.d.ts +1 -0
- package/dist/components/StepsBlock/StepsBlock.js +3 -2
- package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlock.mobile.js +2 -1
- package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -0
- package/dist/model/Picture.d.ts +6 -0
- package/dist/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
- package/dist/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/dist/ui-kit/Button/ButtonSection.js +2 -2
- package/dist/ui-kit/Button/ButtonSection.js.map +1 -1
- package/dist/ui-kit/Img/Img.js +2 -6
- package/dist/ui-kit/Img/Img.js.map +1 -1
- package/dist/utils/checkIsIconRenderable.d.ts +2 -0
- package/dist/utils/checkIsIconRenderable.js +5 -0
- package/dist/utils/checkIsIconRenderable.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/Accordion/AccordionContent.d.ts +6 -3
- package/lib/components/Bonus/Bonus.js +1 -1
- package/lib/components/Bonus/Bonus.js.map +1 -1
- package/lib/components/Bonus/BonusContent.d.ts +1 -1
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +5 -5
- package/lib/components/Calculator/Calculator.js +1 -1
- package/lib/components/Calculator/Calculator.js.map +1 -1
- package/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +5 -3
- package/lib/components/GracePeriod/GracePeriod.js +2 -2
- package/lib/components/GracePeriod/GracePeriod.js.map +1 -1
- package/lib/components/GracePeriod/GracePeriodContent.d.ts +2 -2
- package/lib/components/GroupBlock/GroupBlockContent.d.ts +2 -2
- package/lib/components/GroupBlock/GroupBlockTabs.js +1 -1
- package/lib/components/GroupBlock/GroupBlockTabs.js.map +1 -1
- package/lib/components/LinkDocs/LinkDocsContent.d.ts +10 -1
- package/lib/components/PictureText/PictureTextContent.d.ts +1 -0
- package/lib/components/StepsBlock/StepsBlock.js +3 -2
- package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.mobile.js +2 -1
- package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -0
- package/lib/model/Picture.d.ts +6 -0
- package/lib/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
- package/lib/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/lib/ui-kit/Button/ButtonSection.js +2 -2
- package/lib/ui-kit/Button/ButtonSection.js.map +1 -1
- package/lib/ui-kit/Img/Img.js +2 -6
- package/lib/ui-kit/Img/Img.js.map +1 -1
- package/lib/utils/checkIsIconRenderable.d.ts +2 -0
- package/lib/utils/checkIsIconRenderable.js +2 -0
- package/lib/utils/checkIsIconRenderable.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +5 -3
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Accordion/AccordionContent.d.ts +6 -3
- package/mobile/dist/components/Bonus/Bonus.js +1 -1
- package/mobile/dist/components/Bonus/Bonus.js.map +1 -1
- package/mobile/dist/components/Bonus/BonusContent.d.ts +1 -1
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +5 -5
- package/mobile/dist/components/Calculator/Calculator.js +1 -1
- package/mobile/dist/components/Calculator/Calculator.js.map +1 -1
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +5 -3
- package/mobile/dist/components/GracePeriod/GracePeriod.js +2 -2
- package/mobile/dist/components/GracePeriod/GracePeriod.js.map +1 -1
- package/mobile/dist/components/GracePeriod/GracePeriodContent.d.ts +2 -2
- package/mobile/dist/components/GroupBlock/GroupBlockContent.d.ts +2 -2
- package/mobile/dist/components/GroupBlock/GroupBlockTabs.js +1 -1
- package/mobile/dist/components/GroupBlock/GroupBlockTabs.js.map +1 -1
- package/mobile/dist/components/LinkDocs/LinkDocsContent.d.ts +10 -1
- package/mobile/dist/components/PictureText/PictureTextContent.d.ts +1 -0
- package/mobile/dist/components/StepsBlock/StepsBlock.js +2 -1
- package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -0
- package/mobile/dist/model/Picture.d.ts +6 -0
- package/mobile/dist/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
- package/mobile/dist/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/mobile/dist/ui-kit/Button/ButtonSection.js +2 -2
- package/mobile/dist/ui-kit/Button/ButtonSection.js.map +1 -1
- package/mobile/dist/utils/checkIsIconRenderable.d.ts +2 -0
- package/mobile/dist/utils/checkIsIconRenderable.js +5 -0
- package/mobile/dist/utils/checkIsIconRenderable.js.map +1 -0
- package/mobile/lib/components/Accordion/AccordionContent.d.ts +6 -3
- package/mobile/lib/components/Bonus/Bonus.js +1 -1
- package/mobile/lib/components/Bonus/Bonus.js.map +1 -1
- package/mobile/lib/components/Bonus/BonusContent.d.ts +1 -1
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +5 -5
- package/mobile/lib/components/Calculator/Calculator.js +1 -1
- package/mobile/lib/components/Calculator/Calculator.js.map +1 -1
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +5 -3
- package/mobile/lib/components/GracePeriod/GracePeriod.js +2 -2
- package/mobile/lib/components/GracePeriod/GracePeriod.js.map +1 -1
- package/mobile/lib/components/GracePeriod/GracePeriodContent.d.ts +2 -2
- package/mobile/lib/components/GroupBlock/GroupBlockContent.d.ts +2 -2
- package/mobile/lib/components/GroupBlock/GroupBlockTabs.js +1 -1
- package/mobile/lib/components/GroupBlock/GroupBlockTabs.js.map +1 -1
- package/mobile/lib/components/LinkDocs/LinkDocsContent.d.ts +10 -1
- package/mobile/lib/components/PictureText/PictureTextContent.d.ts +1 -0
- package/mobile/lib/components/StepsBlock/StepsBlock.js +2 -1
- package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -0
- package/mobile/lib/model/Picture.d.ts +6 -0
- package/mobile/lib/ui-kit/BlocksList/BlocksListProps.d.ts +10 -10
- package/mobile/lib/ui-kit/Button/ButtonProps.d.ts +2 -0
- package/mobile/lib/ui-kit/Button/ButtonSection.js +2 -2
- package/mobile/lib/ui-kit/Button/ButtonSection.js.map +1 -1
- package/mobile/lib/utils/checkIsIconRenderable.d.ts +2 -0
- package/mobile/lib/utils/checkIsIconRenderable.js +2 -0
- package/mobile/lib/utils/checkIsIconRenderable.js.map +1 -0
- package/mobile/src/components/Accordion/Accordion.example.json +13 -6
- package/mobile/src/components/Accordion/AccordionContent.ts +6 -3
- package/mobile/src/components/Bonus/Bonus.example.json +1 -1
- package/mobile/src/components/Bonus/Bonus.tsx +2 -2
- package/mobile/src/components/Bonus/BonusContent.ts +1 -1
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +40 -0
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +5 -5
- package/mobile/src/components/Calculator/Calculator.tsx +1 -1
- package/mobile/src/components/ContentPage/ContentPage.page.json +5 -5
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +5 -4
- package/mobile/src/components/GracePeriod/GracePeriod.example.json +4 -4
- package/mobile/src/components/GracePeriod/GracePeriod.tsx +4 -4
- package/mobile/src/components/GracePeriod/GracePeriodContent.ts +2 -2
- package/mobile/src/components/GroupBlock/GroupBlock.example.json +72 -3
- package/mobile/src/components/GroupBlock/GroupBlockContent.ts +2 -2
- package/mobile/src/components/GroupBlock/GroupBlockTabs.tsx +3 -1
- package/mobile/src/components/LinkDocs/LinkDocsContent.ts +10 -1
- package/mobile/src/components/MobileAppTile/MobileAppTile.example.json +12 -2
- package/mobile/src/components/OtherProducts/OtherProducts.example.json +12 -6
- package/mobile/src/components/PictureText/PictureTextContent.ts +1 -0
- package/mobile/src/components/ProductBlock/ProductBlock.example.json +3 -10
- package/mobile/src/components/ProductTile/ProductTile.example.json +1 -2
- package/mobile/src/components/PromoTile/PromoTile.example.json +1 -2
- package/mobile/src/components/StepsBlock/StepsBlock.example.json +18 -3
- package/mobile/src/components/StepsBlock/StepsBlock.tsx +6 -1
- package/mobile/src/components/StepsBlock/StepsBlockContent.ts +11 -0
- package/mobile/src/components/Tile/Tile.example.json +2 -9
- package/mobile/src/model/Picture.ts +7 -0
- package/mobile/src/ui-kit/BlocksList/BlocksListProps.ts +42 -20
- package/mobile/src/ui-kit/Button/ButtonProps.ts +2 -0
- package/mobile/src/ui-kit/Button/ButtonSection.tsx +2 -1
- package/mobile/src/utils/checkIsIconRenderable.tsx +3 -0
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.example.json +13 -6
- package/src/components/Accordion/AccordionContent.ts +6 -3
- package/src/components/Bonus/Bonus.example.json +1 -1
- package/src/components/Bonus/Bonus.fixture.tsx +3 -3
- package/src/components/Bonus/Bonus.tsx +2 -2
- package/src/components/Bonus/BonusContent.ts +1 -1
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +40 -0
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +5 -5
- package/src/components/Calculator/Calculator.tsx +1 -1
- package/src/components/ContentPage/ContentPage.page.json +5 -5
- package/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +5 -4
- package/src/components/GracePeriod/GracePeriod.example.json +4 -4
- package/src/components/GracePeriod/GracePeriod.fixture.tsx +9 -9
- package/src/components/GracePeriod/GracePeriod.tsx +4 -4
- package/src/components/GracePeriod/GracePeriodContent.ts +2 -2
- package/src/components/GroupBlock/GroupBlock.example.json +72 -3
- package/src/components/GroupBlock/GroupBlockContent.ts +2 -2
- package/src/components/GroupBlock/GroupBlockTabs.tsx +3 -1
- package/src/components/LinkDocs/LinkDocsContent.ts +10 -1
- package/src/components/MobileAppTile/MobileAppTile.example.json +12 -2
- package/src/components/OtherProducts/OtherProducts.example.json +12 -6
- package/src/components/PictureText/PictureTextContent.ts +1 -0
- package/src/components/ProductBlock/ProductBlock.example.json +3 -10
- package/src/components/ProductBlock/ProductBlock.fixture.tsx +2 -2
- package/src/components/ProductTile/ProductTile.example.json +1 -2
- package/src/components/PromoTile/PromoTile.example.json +1 -2
- package/src/components/StepsBlock/StepsBlock.example.json +18 -3
- package/src/components/StepsBlock/StepsBlock.mobile.tsx +6 -1
- package/src/components/StepsBlock/StepsBlock.tsx +19 -13
- package/src/components/StepsBlock/StepsBlockContent.ts +11 -0
- package/src/components/Tile/Tile.example.json +2 -9
- package/src/model/Picture.ts +7 -0
- package/src/ui-kit/BlocksList/BlocksListProps.ts +42 -20
- package/src/ui-kit/Button/ButtonProps.ts +2 -0
- package/src/ui-kit/Button/ButtonSection.tsx +2 -1
- package/src/ui-kit/Img/Img.tsx +9 -16
- package/src/utils/checkIsIconRenderable.tsx +3 -0
|
@@ -7,21 +7,14 @@
|
|
|
7
7
|
"format": "webp",
|
|
8
8
|
"size": {
|
|
9
9
|
"width": 445
|
|
10
|
-
}
|
|
11
|
-
"alt": "",
|
|
12
|
-
"title": ""
|
|
10
|
+
}
|
|
13
11
|
},
|
|
14
12
|
"isDotted": true,
|
|
15
13
|
"items": ["Пункт 1", "Пункт 2", "Пункт 3"],
|
|
16
14
|
"buttons": [
|
|
17
15
|
{
|
|
18
16
|
"text": "Кнопка",
|
|
19
|
-
"version": "primary"
|
|
20
|
-
"target": "",
|
|
21
|
-
"icon": {
|
|
22
|
-
"alt": "",
|
|
23
|
-
"title": ""
|
|
24
|
-
}
|
|
17
|
+
"version": "primary"
|
|
25
18
|
}
|
|
26
19
|
],
|
|
27
20
|
"version": "primary"
|
package/src/model/Picture.ts
CHANGED
|
@@ -10,6 +10,12 @@ export interface Img {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @title Брейкпоинт
|
|
15
|
+
* @enumNames ["1919px и меньше", "1439px и меньше", "1279px и меньше"]
|
|
16
|
+
*/
|
|
17
|
+
export type MediaQuery = '(max-width: 1919px)' | '(max-width: 1439px)' | '(max-width: 1279px)';
|
|
18
|
+
|
|
13
19
|
export interface ImgSource {
|
|
14
20
|
/** @title Иконка */
|
|
15
21
|
icon?: IconName;
|
|
@@ -20,6 +26,7 @@ export interface ImgSource {
|
|
|
20
26
|
format?: 'jpeg' | 'jpg' | 'png' | 'gif' | 'webp' | 'heif' | 'avif';
|
|
21
27
|
/** @hidden */
|
|
22
28
|
options?: Record<string, any>;
|
|
29
|
+
media?: MediaQuery;
|
|
23
30
|
/** @title Размер изображения */
|
|
24
31
|
size?: {
|
|
25
32
|
/** @title Ширина */
|
|
@@ -27,71 +27,93 @@ export interface BlocksCommonProps {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @title Заголовок
|
|
30
|
-
* @default {"blockListType": "Headline"}
|
|
31
30
|
*/
|
|
32
31
|
export type HeadlineBlockListDef = HeadlineContent &
|
|
33
|
-
BlocksCommonProps & {
|
|
32
|
+
BlocksCommonProps & {
|
|
33
|
+
/** @default Headline */
|
|
34
|
+
blockListType: 'Headline';
|
|
35
|
+
};
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* @title Список документов
|
|
37
|
-
* @default {"blockListType": "LinkDocs"}
|
|
38
39
|
*/
|
|
39
40
|
export type LinkDocsBlockListDef = LinkDocsContent &
|
|
40
|
-
BlocksCommonProps & {
|
|
41
|
+
BlocksCommonProps & {
|
|
42
|
+
/** @default LinkDocs */
|
|
43
|
+
blockListType: 'LinkDocs';
|
|
44
|
+
};
|
|
41
45
|
|
|
42
46
|
/**
|
|
43
47
|
* @title Текстовый блок
|
|
44
|
-
* @default {"blockListType": "TextBlock"}
|
|
45
48
|
*/
|
|
46
49
|
export type TextBlockBlockListDef = TextBlockContent &
|
|
47
|
-
BlocksCommonProps & {
|
|
50
|
+
BlocksCommonProps & {
|
|
51
|
+
/** @default TextBlock */
|
|
52
|
+
blockListType: 'TextBlock';
|
|
53
|
+
};
|
|
48
54
|
|
|
49
55
|
/**
|
|
50
56
|
* @title Картинка с текстом
|
|
51
|
-
* @default {"blockListType": "PictureText"}
|
|
52
57
|
*/
|
|
53
58
|
export type PictureTextBlockListDef = PictureTextContent &
|
|
54
|
-
BlocksCommonProps & {
|
|
59
|
+
BlocksCommonProps & {
|
|
60
|
+
/** @default PictureText */
|
|
61
|
+
blockListType: 'PictureText';
|
|
62
|
+
};
|
|
55
63
|
|
|
56
64
|
/**
|
|
57
65
|
* @title Продуктовый блок
|
|
58
|
-
* @default {"blockListType": "ProductBlock"}
|
|
59
66
|
*/
|
|
60
67
|
export type ProductBlockBlockListDef = ProductBlockContent &
|
|
61
|
-
BlocksCommonProps & {
|
|
68
|
+
BlocksCommonProps & {
|
|
69
|
+
/** @default ProductBlock */
|
|
70
|
+
blockListType: 'ProductBlock';
|
|
71
|
+
};
|
|
62
72
|
|
|
63
73
|
/**
|
|
64
74
|
* @title Плитка
|
|
65
|
-
* @default {"blockListType": "Tile"}
|
|
66
75
|
*/
|
|
67
|
-
export type TileBlockListDef = TileContent &
|
|
76
|
+
export type TileBlockListDef = TileContent &
|
|
77
|
+
BlocksCommonProps & {
|
|
78
|
+
/** @default Tile */
|
|
79
|
+
blockListType: 'Tile';
|
|
80
|
+
};
|
|
68
81
|
|
|
69
82
|
/**
|
|
70
83
|
* @title Продуктовая плитка
|
|
71
|
-
* @default {"blockListType": "ProductTile"}
|
|
72
84
|
*/
|
|
73
85
|
export type ProductTileBlockListDef = ProductTileContent &
|
|
74
|
-
BlocksCommonProps & {
|
|
86
|
+
BlocksCommonProps & {
|
|
87
|
+
/** @default ProductTile */
|
|
88
|
+
blockListType: 'ProductTile';
|
|
89
|
+
};
|
|
75
90
|
|
|
76
91
|
/**
|
|
77
92
|
* @title Галерея
|
|
78
|
-
* @default {"blockListType": "Gallery"}
|
|
79
93
|
*/
|
|
80
|
-
export type GalleryBlockListDef = GalleryContent &
|
|
94
|
+
export type GalleryBlockListDef = GalleryContent &
|
|
95
|
+
BlocksCommonProps & {
|
|
96
|
+
/** @default Gallery */
|
|
97
|
+
blockListType: 'Gallery';
|
|
98
|
+
};
|
|
81
99
|
|
|
82
100
|
/**
|
|
83
101
|
* @title Мини-галлерея
|
|
84
|
-
* @default {"blockListType": "MiniGallery"}
|
|
85
102
|
*/
|
|
86
103
|
export type MiniGalleryBlockListDef = MiniGalleryContent &
|
|
87
|
-
BlocksCommonProps & {
|
|
104
|
+
BlocksCommonProps & {
|
|
105
|
+
/** @default MiniGallery */
|
|
106
|
+
blockListType: 'MiniGallery';
|
|
107
|
+
};
|
|
88
108
|
|
|
89
109
|
/**
|
|
90
110
|
* @title Список ссылок
|
|
91
|
-
* @default {"blockListType": "LinkList"}
|
|
92
111
|
*/
|
|
93
112
|
export type LinkListBlockListDef = LinkListContent &
|
|
94
|
-
BlocksCommonProps & {
|
|
113
|
+
BlocksCommonProps & {
|
|
114
|
+
/** @default LinkList */
|
|
115
|
+
blockListType: 'LinkList';
|
|
116
|
+
};
|
|
95
117
|
|
|
96
118
|
/**
|
|
97
119
|
* @title Содержимое блока
|
|
@@ -28,6 +28,8 @@ export interface ButtonProps extends ButtonAdditionalProps, LinkProps {
|
|
|
28
28
|
export interface ButtonWithIconProps extends ButtonProps {
|
|
29
29
|
/** @title Иконка */
|
|
30
30
|
icon?: Picture;
|
|
31
|
+
/** @title Иконка справа */
|
|
32
|
+
iconRight?: Picture;
|
|
31
33
|
/** @title Верхний текст */
|
|
32
34
|
aboveText?: string;
|
|
33
35
|
/** @hidden */
|
|
@@ -20,7 +20,7 @@ export const ButtonSection = JSX<ButtonSectionProps>(({ context, className = '',
|
|
|
20
20
|
) : null;
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
function renderButton({ icon, ...button }: ButtonWithIconProps, i: number) {
|
|
23
|
+
function renderButton({ icon, iconRight, ...button }: ButtonWithIconProps, i: number) {
|
|
24
24
|
if (!button?.text) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -29,6 +29,7 @@ function renderButton({ icon, ...button }: ButtonWithIconProps, i: number) {
|
|
|
29
29
|
<Button
|
|
30
30
|
key={String(i)}
|
|
31
31
|
appendLeft={<Img image={icon} width="24" height="24" asSVG />}
|
|
32
|
+
appendRight={<Img image={iconRight} width="24" height="24" asSVG />}
|
|
32
33
|
{...button}
|
|
33
34
|
/>
|
|
34
35
|
) : (
|
package/src/ui-kit/Img/Img.tsx
CHANGED
|
@@ -43,8 +43,14 @@ export const ImgAsPicture = JSX<ImageProps<Picture>>(
|
|
|
43
43
|
return (
|
|
44
44
|
<picture className={`flex-none ${className}`}>
|
|
45
45
|
{image?.sources?.length
|
|
46
|
-
? image.sources.map(({ src, format }, index) => (
|
|
47
|
-
<source
|
|
46
|
+
? image.sources.map(({ src, format, media, size }, index) => (
|
|
47
|
+
<source
|
|
48
|
+
key={`${index}_${src}`}
|
|
49
|
+
srcSet={src}
|
|
50
|
+
type={formatToMimeType(format)}
|
|
51
|
+
media={media}
|
|
52
|
+
{...size}
|
|
53
|
+
/>
|
|
48
54
|
))
|
|
49
55
|
: null}
|
|
50
56
|
{renderImg(image, imageClassName)}
|
|
@@ -54,23 +60,10 @@ export const ImgAsPicture = JSX<ImageProps<Picture>>(
|
|
|
54
60
|
);
|
|
55
61
|
|
|
56
62
|
const renderImg = (image: Picture, imageClassName = '') => {
|
|
57
|
-
const style = {
|
|
58
|
-
width: image.size?.width ? `${image.size?.width}px` : '100%',
|
|
59
|
-
height: image.size?.height ? `${image.size?.height}px` : '100%',
|
|
60
|
-
};
|
|
61
63
|
const title = image.title || '';
|
|
62
64
|
const alt = image.alt || image.title;
|
|
63
65
|
|
|
64
|
-
return
|
|
65
|
-
<img
|
|
66
|
-
src={image.src}
|
|
67
|
-
className={imageClassName}
|
|
68
|
-
alt={alt}
|
|
69
|
-
title={title}
|
|
70
|
-
style={style}
|
|
71
|
-
{...image.size}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
66
|
+
return <img src={image.src} className={imageClassName} alt={alt} title={title} {...image.size} />;
|
|
74
67
|
};
|
|
75
68
|
|
|
76
69
|
export function formatToMimeType(format: ImgSource['format']): string | undefined {
|