@redneckz/wildless-cms-uni-blocks 0.7.7 → 0.7.9

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 (129) hide show
  1. package/bin/migration-scripts/0.7.8.js +29 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +40 -17
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/PictureText/renderBenefit.d.ts +4 -0
  6. package/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  7. package/bundle/ui-kit/SlideCheckbox/SlideCheckbox.d.ts +7 -0
  8. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
  9. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  10. package/dist/components/ErrorBlock/ErrorBlock.js +3 -1
  11. package/dist/components/ErrorBlock/ErrorBlock.js.map +1 -1
  12. package/dist/components/Header/DropdownMenu.js +4 -1
  13. package/dist/components/Header/DropdownMenu.js.map +1 -1
  14. package/dist/components/OtherProductsItem/OtherProductsItem.js +3 -1
  15. package/dist/components/OtherProductsItem/OtherProductsItem.js.map +1 -1
  16. package/dist/components/PictureText/PictureText.js +2 -3
  17. package/dist/components/PictureText/PictureText.js.map +1 -1
  18. package/dist/components/PictureText/renderBenefit.d.ts +4 -0
  19. package/dist/components/PictureText/renderBenefit.js +25 -0
  20. package/dist/components/PictureText/renderBenefit.js.map +1 -0
  21. package/dist/components/ProductTile/renderBenefit.js +1 -1
  22. package/dist/components/ProductTile/renderBenefit.js.map +1 -1
  23. package/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  24. package/dist/ui-kit/SlideCheckbox/SlideCheckbox.d.ts +7 -0
  25. package/dist/ui-kit/SlideCheckbox/SlideCheckbox.js +7 -0
  26. package/dist/ui-kit/SlideCheckbox/SlideCheckbox.js.map +1 -0
  27. package/dist/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
  28. package/dist/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
  29. package/lib/common.css +1 -1
  30. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
  31. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  32. package/lib/components/ErrorBlock/ErrorBlock.js +3 -1
  33. package/lib/components/ErrorBlock/ErrorBlock.js.map +1 -1
  34. package/lib/components/Header/DropdownMenu.js +4 -1
  35. package/lib/components/Header/DropdownMenu.js.map +1 -1
  36. package/lib/components/OtherProductsItem/OtherProductsItem.js +3 -1
  37. package/lib/components/OtherProductsItem/OtherProductsItem.js.map +1 -1
  38. package/lib/components/PictureText/PictureText.fixture.d.ts +2 -0
  39. package/lib/components/PictureText/PictureText.js +1 -2
  40. package/lib/components/PictureText/PictureText.js.map +1 -1
  41. package/lib/components/PictureText/renderBenefit.d.ts +4 -0
  42. package/lib/components/PictureText/renderBenefit.js +22 -0
  43. package/lib/components/PictureText/renderBenefit.js.map +1 -0
  44. package/lib/components/ProductTile/renderBenefit.js +1 -1
  45. package/lib/components/ProductTile/renderBenefit.js.map +1 -1
  46. package/lib/components/SwipeListControlBlock/SwipeListControlBlock.fixture.d.ts +1 -0
  47. package/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  48. package/lib/ui-kit/SlideCheckbox/SlideCheckbox.d.ts +7 -0
  49. package/lib/ui-kit/SlideCheckbox/SlideCheckbox.fixture.d.ts +5 -0
  50. package/lib/ui-kit/SlideCheckbox/SlideCheckbox.js +5 -0
  51. package/lib/ui-kit/SlideCheckbox/SlideCheckbox.js.map +1 -0
  52. package/lib/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
  53. package/lib/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
  54. package/mobile/bundle/bundle.umd.js +2 -2
  55. package/mobile/bundle/bundle.umd.min.js +1 -1
  56. package/mobile/bundle/components/PictureText/renderBenefit.d.ts +4 -0
  57. package/mobile/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  58. package/mobile/bundle/ui-kit/SlideCheckbox/SlideCheckbox.d.ts +7 -0
  59. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
  60. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  61. package/mobile/dist/components/ErrorBlock/ErrorBlock.js +3 -1
  62. package/mobile/dist/components/ErrorBlock/ErrorBlock.js.map +1 -1
  63. package/mobile/dist/components/Header/DropdownMenu.js +4 -1
  64. package/mobile/dist/components/Header/DropdownMenu.js.map +1 -1
  65. package/mobile/dist/components/OtherProductsItem/OtherProductsItem.js +3 -1
  66. package/mobile/dist/components/OtherProductsItem/OtherProductsItem.js.map +1 -1
  67. package/mobile/dist/components/PictureText/PictureText.js +2 -3
  68. package/mobile/dist/components/PictureText/PictureText.js.map +1 -1
  69. package/mobile/dist/components/PictureText/renderBenefit.d.ts +4 -0
  70. package/mobile/dist/components/PictureText/renderBenefit.js +25 -0
  71. package/mobile/dist/components/PictureText/renderBenefit.js.map +1 -0
  72. package/mobile/dist/components/ProductTile/renderBenefit.js +1 -1
  73. package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -1
  74. package/mobile/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  75. package/mobile/dist/ui-kit/SlideCheckbox/SlideCheckbox.d.ts +7 -0
  76. package/mobile/dist/ui-kit/SlideCheckbox/SlideCheckbox.js +7 -0
  77. package/mobile/dist/ui-kit/SlideCheckbox/SlideCheckbox.js.map +1 -0
  78. package/mobile/dist/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
  79. package/mobile/dist/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
  80. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
  81. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  82. package/mobile/lib/components/ErrorBlock/ErrorBlock.js +3 -1
  83. package/mobile/lib/components/ErrorBlock/ErrorBlock.js.map +1 -1
  84. package/mobile/lib/components/Header/DropdownMenu.js +4 -1
  85. package/mobile/lib/components/Header/DropdownMenu.js.map +1 -1
  86. package/mobile/lib/components/OtherProductsItem/OtherProductsItem.js +3 -1
  87. package/mobile/lib/components/OtherProductsItem/OtherProductsItem.js.map +1 -1
  88. package/mobile/lib/components/PictureText/PictureText.js +1 -2
  89. package/mobile/lib/components/PictureText/PictureText.js.map +1 -1
  90. package/mobile/lib/components/PictureText/renderBenefit.d.ts +4 -0
  91. package/mobile/lib/components/PictureText/renderBenefit.js +22 -0
  92. package/mobile/lib/components/PictureText/renderBenefit.js.map +1 -0
  93. package/mobile/lib/components/ProductTile/renderBenefit.js +1 -1
  94. package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -1
  95. package/mobile/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  96. package/mobile/lib/ui-kit/SlideCheckbox/SlideCheckbox.d.ts +7 -0
  97. package/mobile/lib/ui-kit/SlideCheckbox/SlideCheckbox.js +5 -0
  98. package/mobile/lib/ui-kit/SlideCheckbox/SlideCheckbox.js.map +1 -0
  99. package/mobile/lib/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
  100. package/mobile/lib/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
  101. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +5 -1
  102. package/mobile/src/components/ErrorBlock/ErrorBlock.tsx +10 -1
  103. package/mobile/src/components/Header/DropdownMenu.tsx +16 -12
  104. package/mobile/src/components/OtherProductsItem/OtherProductsItem.tsx +3 -1
  105. package/mobile/src/components/PictureText/PictureText.tsx +1 -14
  106. package/mobile/src/components/PictureText/PictureText.ui.json +10 -0
  107. package/mobile/src/components/PictureText/renderBenefit.tsx +33 -0
  108. package/mobile/src/components/ProductTile/renderBenefit.tsx +5 -1
  109. package/mobile/src/components/SwipeListControlBlock/SwipeListControlBlock.example.json +1 -1
  110. package/mobile/src/ui-kit/BenefitItem/BenefitItemProps.ts +28 -3
  111. package/mobile/src/ui-kit/SlideCheckbox/SlideCheckbox.tsx +33 -0
  112. package/mobile/src/ui-kit/SwipeListControl/SwipeListControlDots.tsx +1 -1
  113. package/package.json +1 -1
  114. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.tsx +1 -0
  115. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +5 -1
  116. package/src/components/ErrorBlock/ErrorBlock.tsx +10 -1
  117. package/src/components/Header/DropdownMenu.tsx +16 -12
  118. package/src/components/OtherProductsItem/OtherProductsItem.tsx +3 -1
  119. package/src/components/PictureText/PictureText.fixture.tsx +37 -0
  120. package/src/components/PictureText/PictureText.tsx +1 -14
  121. package/src/components/PictureText/PictureText.ui.json +10 -0
  122. package/src/components/PictureText/renderBenefit.tsx +33 -0
  123. package/src/components/ProductTile/renderBenefit.tsx +5 -1
  124. package/src/components/SwipeListControlBlock/SwipeListControlBlock.example.json +1 -1
  125. package/src/components/SwipeListControlBlock/SwipeListControlBlock.fixture.tsx +17 -0
  126. package/src/ui-kit/BenefitItem/BenefitItemProps.ts +28 -3
  127. package/src/ui-kit/SlideCheckbox/SlideCheckbox.fixture.tsx +9 -0
  128. package/src/ui-kit/SlideCheckbox/SlideCheckbox.tsx +33 -0
  129. package/src/ui-kit/SwipeListControl/SwipeListControlDots.tsx +1 -1
@@ -8,7 +8,7 @@ const activeDotStyles = {
8
8
  'horizontal-list': 'w-6',
9
9
  'vertical-list': 'h-6',
10
10
  };
11
- const dotStyle = 'cursor-pointer bg-primary-main rounded-full transition-width duration-300 group-data-secondary:bg-white';
11
+ const dotStyle = 'cursor-pointer bg-primary-main rounded-full transition-width duration-300 group-data-secondary:bg-white group-data-transparent:bg-white';
12
12
  const inactiveDotStyle = 'w-2 h-2 opacity-30';
13
13
  export const SwipeListControlDots = JSX(({ containerRef, activeIndex, dotCount = 0, listType = 'horizontal-list' }) => {
14
14
  const handleClick = (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,CAAC,EAAE,GAAW,EAAE,EAAE,CAAC,CACtD,cAEE,SAAS,EAAE,GAAG,QAAQ,IACpB,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,gBACpD,EAAE,EACF,IAAI,EAAC,QAAQ,uBAEb,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAN1B,MAAM,CAAC,GAAG,CAAC,CAOhB,CACH,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CACF,CAAC"}
@@ -45,7 +45,11 @@ export const CarouselRecommendationCard = JSX<RecommendationCardProps>(
45
45
  >
46
46
  <BaseTile className="flex justify-between" title={tileTitle} image={tileImage}>
47
47
  <div className="h-full flex flex-col justify-between">
48
- {description ? <span className="mb-2">{description}</span> : null}
48
+ {description ? (
49
+ <span className="mb-2 group-data-gray:text-secondary-text group-data-gray:max-w-[265px]">
50
+ {description}
51
+ </span>
52
+ ) : null}
49
53
  {items.length ? (
50
54
  <List
51
55
  className="text-xl-light flex flex-col flex-1 gap-2 max-w-[236px]"
@@ -4,6 +4,7 @@ import { Button } from '../../ui-kit/Button/Button';
4
4
  import { Heading } from '../../ui-kit/Heading/Heading';
5
5
  import { Img } from '../../ui-kit/Img/Img';
6
6
  import type { ErrorBlockContent } from './ErrorBlockContent';
7
+ import { style } from '../../utils/style';
7
8
 
8
9
  export interface ErrorBlockProps extends ErrorBlockContent, UniBlockProps {}
9
10
 
@@ -19,9 +20,17 @@ const renderErrorContent = (error: ErrorBlockContent['error']) => {
19
20
  return null;
20
21
  };
21
22
 
23
+ const getErrorBlockStyle = (text: string) => (text ? 'py-20 pt-3 pb-1' : 'mb-16 pb-2 mt-24 pt-3');
24
+
22
25
  export const ErrorBlock = JSX<ErrorBlockProps>(
23
26
  ({ className = '', title, subtitle, error, button }) => (
24
- <section className={`flex flex-col justify-center items-center mt-12 ${className}`}>
27
+ <section
28
+ className={style(
29
+ 'flex flex-col justify-center items-center',
30
+ getErrorBlockStyle(button?.text as string),
31
+ className,
32
+ )}
33
+ >
25
34
  <div className="flex justify-center py-20">{renderErrorContent(error)}</div>
26
35
  {title ? <Heading headingType="h1" className="text-left mb-4" title={title} /> : null}
27
36
  {subtitle ? (
@@ -43,18 +43,22 @@ export const DropdownMenu = JSX<DropdownMenuProps>(({ className = '', items, act
43
43
  className={style('flex flex-col rounded-md bg-white p-6 pb-2', visible ? '' : 'hidden')}
44
44
  aria-hidden={!visible}
45
45
  >
46
- {items?.map((item, i) => (
47
- <a
48
- key={item.href || String(i)}
49
- className={style(
50
- 'text-l-light pb-4 hover:text-primary-main',
51
- item === activeItem ? 'text-primary-main' : '',
52
- )}
53
- {...link(item)}
54
- >
55
- {item.text}
56
- </a>
57
- ))}
46
+ {items?.map((item, i) => {
47
+ const { text, ...linkProps } = item;
48
+
49
+ return (
50
+ <a
51
+ key={item.href || String(i)}
52
+ className={style(
53
+ 'text-l-light pb-4 hover:text-primary-main',
54
+ item === activeItem ? 'text-primary-main' : '',
55
+ )}
56
+ {...link(linkProps)}
57
+ >
58
+ {text}
59
+ </a>
60
+ );
61
+ })}
58
62
  </div>
59
63
  </div>
60
64
  );
@@ -45,4 +45,6 @@ export const OtherProductsItem: JSXBlock<OtherProductsItemProps> = JSX<OtherProd
45
45
  },
46
46
  );
47
47
 
48
- OtherProductsItem.childrenTypes = []; // All types of blocks are suitable
48
+ OtherProductsItem.childrenTypes = {
49
+ exclude: ['OtherProductsItem'],
50
+ };
@@ -1,13 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { BlockVersion } from '../../model/BlockVersion';
3
2
  import type { UniBlockProps } from '../../model/JSXBlock';
4
- import { BenefitItem } from '../../ui-kit/BenefitItem/BenefitItem';
5
- import type { BenefitItemProps } from '../../ui-kit/BenefitItem/BenefitItemProps';
6
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
4
  import { Img } from '../../ui-kit/Img/Img';
8
5
  import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
9
6
  import { Headline } from '../Headline/Headline';
10
7
  import type { PictureTextContent } from './PictureTextContent';
8
+ import { renderBenefit } from './renderBenefit';
11
9
 
12
10
  export interface PictureTextProps extends PictureTextContent, UniBlockProps {}
13
11
 
@@ -39,17 +37,6 @@ export const PictureText = JSX<PictureTextProps>(
39
37
  ),
40
38
  );
41
39
 
42
- const renderBenefit = (version: BlockVersion) => (benefit: BenefitItemProps, i: number) =>
43
- (
44
- <BenefitItem
45
- key={String(i)}
46
- icon={benefit.icon}
47
- label={benefit.label}
48
- description={benefit.description}
49
- version={version}
50
- />
51
- );
52
-
53
40
  function renderInsuranceSumMonth(sum?: number, monthLimit?: number) {
54
41
  return sum || monthLimit ? (
55
42
  <div className="bg-main-divider rounded-md flex mt-7 gap-6 px-5 py-4">
@@ -5,6 +5,16 @@
5
5
  },
6
6
  "monthLimit": {
7
7
  "ui:field": "number"
8
+ },
9
+ "benefits": {
10
+ "items": {
11
+ "__html": {
12
+ "ui:widget": "html"
13
+ },
14
+ "type": {
15
+ "ui:widget": "hidden"
16
+ }
17
+ }
8
18
  }
9
19
  }
10
20
  }
@@ -0,0 +1,33 @@
1
+ import { BlockVersion } from '../../model/BlockVersion';
2
+ import { BenefitItem } from '../../ui-kit/BenefitItem/BenefitItem';
3
+ import type { ComplexBenefitProps } from '../../ui-kit/BenefitItem/BenefitItemProps';
4
+ import { RichText } from '../../ui-kit/RichText/RichText';
5
+ import { assertUnreachable } from '../../utils/assertUnreachable';
6
+
7
+ export const renderBenefit =
8
+ // Linter doesn't understand that switch processes all cases
9
+ // eslint-disable-next-line consistent-return
10
+ (version: BlockVersion) => (benefit: ComplexBenefitProps, i: number) => {
11
+ const { type } = benefit;
12
+
13
+ if (!(type === 'default' || type === 'rte')) {
14
+ return null;
15
+ }
16
+
17
+ switch (type) {
18
+ case 'default':
19
+ return (
20
+ <BenefitItem
21
+ key={String(i)}
22
+ icon={benefit.icon}
23
+ label={benefit.label}
24
+ description={benefit.description}
25
+ version={version}
26
+ />
27
+ );
28
+ case 'rte':
29
+ return <RichText __html={benefit.__html} />;
30
+ default:
31
+ assertUnreachable(benefit);
32
+ }
33
+ };
@@ -29,7 +29,11 @@ export const renderBenefit =
29
29
  </Text>,
30
30
  ];
31
31
  case 'rte':
32
- return <RichText __html={benefit.__html} />;
32
+ return (
33
+ <div className="col-span-2">
34
+ <RichText __html={benefit.__html} />
35
+ </div>
36
+ );
33
37
  default:
34
38
  assertUnreachable(benefit);
35
39
  }
@@ -2,7 +2,7 @@
2
2
  "content": {
3
3
  "listType": "vertical-list"
4
4
  },
5
- "style": ["col-span-12", "h-96"],
5
+ "style": ["col-span-12"],
6
6
  "type": "SwipeListControlBlock",
7
7
  "blocks": [
8
8
  {
@@ -1,7 +1,8 @@
1
- import type { IconProps } from '../../model/Picture';
2
1
  import type { BlockVersion } from '../../model/BlockVersion';
3
- import type { IconVersion } from '../../model/IconVersion';
4
2
  import type { DescriptionProps, LabelProps } from '../../model/HeadlineType';
3
+ import type { IconVersion } from '../../model/IconVersion';
4
+ import type { IconProps } from '../../model/Picture';
5
+ import { RichTextProps } from '../RichText/RichTextProps';
5
6
 
6
7
  export interface BenefitItemCommonProps {
7
8
  /** @hidden */
@@ -14,10 +15,34 @@ export interface BenefitItemCommonProps {
14
15
 
15
16
  export type BenefitItemProps = DescriptionProps & LabelProps & IconProps;
16
17
 
18
+ /**
19
+ * @title Стандартный бенефит
20
+ */
21
+ type DefaultBenefit = BenefitItemProps & {
22
+ /** @default default */
23
+ type: 'default';
24
+ };
25
+
26
+ /**
27
+ * @title Форматированный текст
28
+ */
29
+ type RichText = RichTextProps & {
30
+ /** @default rte */
31
+ type: 'rte';
32
+ };
33
+
34
+ /**
35
+ * @title Преимущество
36
+ * @default{
37
+ * "type": "default"
38
+ * }
39
+ */
40
+ export type ComplexBenefitProps = DefaultBenefit | RichText;
41
+
17
42
  /**
18
43
  * @title Преимущество
19
44
  */
20
45
  export type BenefitsProps = BenefitItemCommonProps & {
21
46
  /** @title Список преимуществ */
22
- benefits?: BenefitItemProps[];
47
+ benefits?: ComplexBenefitProps[];
23
48
  };
@@ -0,0 +1,33 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { Text } from '../../ui-kit/Text/Text';
3
+
4
+ interface SlideCheckboxProps {
5
+ checked?: boolean;
6
+ text?: string;
7
+ onClick?: () => void;
8
+ }
9
+ export const SlideCheckbox = JSX<SlideCheckboxProps>(({ checked, text, onClick }) => (
10
+ <div
11
+ role="checkbox"
12
+ aria-checked={checked}
13
+ className="flex justify-start items-center w-full cursor-pointer mb-4"
14
+ onClick={() => onClick && onClick()}
15
+ >
16
+ <div
17
+ className={`relative duration-300 w-9 h-5 mr-3 rounded rounded-2xl ${
18
+ checked ? 'bg-primary-main' : 'bg-main-divider'
19
+ }`}
20
+ >
21
+ <div
22
+ className={`absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded rounded-full ${
23
+ checked ? 'left-[50%]' : 'left-[5%]'
24
+ }`}
25
+ />
26
+ </div>
27
+ <div>
28
+ <Text size="text-m" font="font-light" color="text-primary-text">
29
+ {text}
30
+ </Text>
31
+ </div>
32
+ </div>
33
+ ));
@@ -12,7 +12,7 @@ const activeDotStyles: Record<SwipeListControlType, string> = {
12
12
  };
13
13
 
14
14
  const dotStyle =
15
- 'cursor-pointer bg-primary-main rounded-full transition-width duration-300 group-data-secondary:bg-white';
15
+ 'cursor-pointer bg-primary-main rounded-full transition-width duration-300 group-data-secondary:bg-white group-data-transparent:bg-white';
16
16
 
17
17
  const inactiveDotStyle = 'w-2 h-2 opacity-30';
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.7.7",
3
+ "version": "0.7.9",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -65,6 +65,7 @@ export default {
65
65
  className="col-span-4"
66
66
  version="gray"
67
67
  {...CAROUSEL_RECOMMENDATION_CARD}
68
+ description="На портале представлено множество ипотечных программ, в том числе и сельская ипотека"
68
69
  />
69
70
  </div>
70
71
  ),
@@ -45,7 +45,11 @@ export const CarouselRecommendationCard = JSX<RecommendationCardProps>(
45
45
  >
46
46
  <BaseTile className="flex justify-between" title={tileTitle} image={tileImage}>
47
47
  <div className="h-full flex flex-col justify-between">
48
- {description ? <span className="mb-2">{description}</span> : null}
48
+ {description ? (
49
+ <span className="mb-2 group-data-gray:text-secondary-text group-data-gray:max-w-[265px]">
50
+ {description}
51
+ </span>
52
+ ) : null}
49
53
  {items.length ? (
50
54
  <List
51
55
  className="text-xl-light flex flex-col flex-1 gap-2 max-w-[236px]"
@@ -4,6 +4,7 @@ import { Button } from '../../ui-kit/Button/Button';
4
4
  import { Heading } from '../../ui-kit/Heading/Heading';
5
5
  import { Img } from '../../ui-kit/Img/Img';
6
6
  import type { ErrorBlockContent } from './ErrorBlockContent';
7
+ import { style } from '../../utils/style';
7
8
 
8
9
  export interface ErrorBlockProps extends ErrorBlockContent, UniBlockProps {}
9
10
 
@@ -19,9 +20,17 @@ const renderErrorContent = (error: ErrorBlockContent['error']) => {
19
20
  return null;
20
21
  };
21
22
 
23
+ const getErrorBlockStyle = (text: string) => (text ? 'py-20 pt-3 pb-1' : 'mb-16 pb-2 mt-24 pt-3');
24
+
22
25
  export const ErrorBlock = JSX<ErrorBlockProps>(
23
26
  ({ className = '', title, subtitle, error, button }) => (
24
- <section className={`flex flex-col justify-center items-center mt-12 ${className}`}>
27
+ <section
28
+ className={style(
29
+ 'flex flex-col justify-center items-center',
30
+ getErrorBlockStyle(button?.text as string),
31
+ className,
32
+ )}
33
+ >
25
34
  <div className="flex justify-center py-20">{renderErrorContent(error)}</div>
26
35
  {title ? <Heading headingType="h1" className="text-left mb-4" title={title} /> : null}
27
36
  {subtitle ? (
@@ -43,18 +43,22 @@ export const DropdownMenu = JSX<DropdownMenuProps>(({ className = '', items, act
43
43
  className={style('flex flex-col rounded-md bg-white p-6 pb-2', visible ? '' : 'hidden')}
44
44
  aria-hidden={!visible}
45
45
  >
46
- {items?.map((item, i) => (
47
- <a
48
- key={item.href || String(i)}
49
- className={style(
50
- 'text-l-light pb-4 hover:text-primary-main',
51
- item === activeItem ? 'text-primary-main' : '',
52
- )}
53
- {...link(item)}
54
- >
55
- {item.text}
56
- </a>
57
- ))}
46
+ {items?.map((item, i) => {
47
+ const { text, ...linkProps } = item;
48
+
49
+ return (
50
+ <a
51
+ key={item.href || String(i)}
52
+ className={style(
53
+ 'text-l-light pb-4 hover:text-primary-main',
54
+ item === activeItem ? 'text-primary-main' : '',
55
+ )}
56
+ {...link(linkProps)}
57
+ >
58
+ {text}
59
+ </a>
60
+ );
61
+ })}
58
62
  </div>
59
63
  </div>
60
64
  );
@@ -45,4 +45,6 @@ export const OtherProductsItem: JSXBlock<OtherProductsItemProps> = JSX<OtherProd
45
45
  },
46
46
  );
47
47
 
48
- OtherProductsItem.childrenTypes = []; // All types of blocks are suitable
48
+ OtherProductsItem.childrenTypes = {
49
+ exclude: ['OtherProductsItem'],
50
+ };
@@ -29,6 +29,14 @@ const imageInsurance: Picture = {
29
29
  ],
30
30
  };
31
31
 
32
+ const imageMonitor: Picture = {
33
+ src: 'monitor.png',
34
+ format: 'webp',
35
+ alt: 'Управление несколькими счетами',
36
+ size: {
37
+ width: 420,
38
+ },
39
+ };
32
40
  export const PICTURE_TEXT: PictureTextContent = {
33
41
  title: 'Обменивайте бонусы на путешествия',
34
42
  description:
@@ -36,11 +44,13 @@ export const PICTURE_TEXT: PictureTextContent = {
36
44
  'бонусные баллы на авиа и ж/д билеты, бронирование отелей и прокат автомобилей.',
37
45
  benefits: [
38
46
  {
47
+ type: 'default',
39
48
  label: 'Кредит по одному документу',
40
49
  description: 'До 300 тыс ₽ по упрощённой процедуре получения кредита',
41
50
  icon: { icon: 'DocumentTextIcon' },
42
51
  },
43
52
  {
53
+ type: 'default',
44
54
  label: 'Кредит на общих условиях',
45
55
  description: 'До 5 млн ₽ на общих условиях получения кредита',
46
56
  icon: { icon: 'DocumentTextIcon' },
@@ -54,19 +64,23 @@ export const INSURANCE_TEXT: PictureTextContent = {
54
64
  description: 'Покрываемые риски программы «Защита вас и ваших близких»',
55
65
  benefits: [
56
66
  {
67
+ type: 'default',
57
68
  label: 'Телесное повреждение',
58
69
  icon: { icon: 'ShieldTickIcon' },
59
70
  },
60
71
  {
72
+ type: 'default',
61
73
  label: 'Госпитализация застрахованного',
62
74
  description: 'Описание',
63
75
  icon: { icon: 'ShieldTickIcon' },
64
76
  },
65
77
  {
78
+ type: 'default',
66
79
  label: 'Сокращение численности работников организации и другой текст для теста длинны текста',
67
80
  icon: { icon: 'ShieldTickIcon' },
68
81
  },
69
82
  {
83
+ type: 'default',
70
84
  label: 'Смерть застрахованного',
71
85
  icon: { icon: 'ShieldTickIcon' },
72
86
  },
@@ -75,6 +89,24 @@ export const INSURANCE_TEXT: PictureTextContent = {
75
89
  sum: 500000,
76
90
  };
77
91
 
92
+ export const BENEFITS_HTML_TEXT: PictureTextContent = {
93
+ title: '',
94
+ benefits: [
95
+ {
96
+ type: 'rte',
97
+ __html:
98
+ '<p class="h3">Управление несколькими счетами</p><p>Контролируйте баланс, пересылайте реквизиты контрагентам и установите любимый счёт для регулярных платежей</p>',
99
+ },
100
+ {
101
+ type: 'rte',
102
+ __html:
103
+ '<p class="h3">Управление несколькими счетами</p><p>Контролируйте баланс, пересылайте реквизиты контрагентам и установите любимый счёт для регулярных платежей</p>',
104
+ },
105
+ ],
106
+
107
+ image: imageMonitor,
108
+ };
109
+
78
110
  export default {
79
111
  default: (
80
112
  <div className="container grid grid-cols-12">
@@ -96,4 +128,9 @@ export default {
96
128
  <PictureText className="col-span-12" {...INSURANCE_TEXT} monthLimit={25000} />
97
129
  </div>
98
130
  ),
131
+ 'benefits as html': (
132
+ <div className="container grid grid-cols-12">
133
+ <PictureText className="col-span-12" {...BENEFITS_HTML_TEXT} />
134
+ </div>
135
+ ),
99
136
  };
@@ -1,13 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { BlockVersion } from '../../model/BlockVersion';
3
2
  import type { UniBlockProps } from '../../model/JSXBlock';
4
- import { BenefitItem } from '../../ui-kit/BenefitItem/BenefitItem';
5
- import type { BenefitItemProps } from '../../ui-kit/BenefitItem/BenefitItemProps';
6
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
4
  import { Img } from '../../ui-kit/Img/Img';
8
5
  import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
9
6
  import { Headline } from '../Headline/Headline';
10
7
  import type { PictureTextContent } from './PictureTextContent';
8
+ import { renderBenefit } from './renderBenefit';
11
9
 
12
10
  export interface PictureTextProps extends PictureTextContent, UniBlockProps {}
13
11
 
@@ -39,17 +37,6 @@ export const PictureText = JSX<PictureTextProps>(
39
37
  ),
40
38
  );
41
39
 
42
- const renderBenefit = (version: BlockVersion) => (benefit: BenefitItemProps, i: number) =>
43
- (
44
- <BenefitItem
45
- key={String(i)}
46
- icon={benefit.icon}
47
- label={benefit.label}
48
- description={benefit.description}
49
- version={version}
50
- />
51
- );
52
-
53
40
  function renderInsuranceSumMonth(sum?: number, monthLimit?: number) {
54
41
  return sum || monthLimit ? (
55
42
  <div className="bg-main-divider rounded-md flex mt-7 gap-6 px-5 py-4">
@@ -5,6 +5,16 @@
5
5
  },
6
6
  "monthLimit": {
7
7
  "ui:field": "number"
8
+ },
9
+ "benefits": {
10
+ "items": {
11
+ "__html": {
12
+ "ui:widget": "html"
13
+ },
14
+ "type": {
15
+ "ui:widget": "hidden"
16
+ }
17
+ }
8
18
  }
9
19
  }
10
20
  }
@@ -0,0 +1,33 @@
1
+ import { BlockVersion } from '../../model/BlockVersion';
2
+ import { BenefitItem } from '../../ui-kit/BenefitItem/BenefitItem';
3
+ import type { ComplexBenefitProps } from '../../ui-kit/BenefitItem/BenefitItemProps';
4
+ import { RichText } from '../../ui-kit/RichText/RichText';
5
+ import { assertUnreachable } from '../../utils/assertUnreachable';
6
+
7
+ export const renderBenefit =
8
+ // Linter doesn't understand that switch processes all cases
9
+ // eslint-disable-next-line consistent-return
10
+ (version: BlockVersion) => (benefit: ComplexBenefitProps, i: number) => {
11
+ const { type } = benefit;
12
+
13
+ if (!(type === 'default' || type === 'rte')) {
14
+ return null;
15
+ }
16
+
17
+ switch (type) {
18
+ case 'default':
19
+ return (
20
+ <BenefitItem
21
+ key={String(i)}
22
+ icon={benefit.icon}
23
+ label={benefit.label}
24
+ description={benefit.description}
25
+ version={version}
26
+ />
27
+ );
28
+ case 'rte':
29
+ return <RichText __html={benefit.__html} />;
30
+ default:
31
+ assertUnreachable(benefit);
32
+ }
33
+ };
@@ -29,7 +29,11 @@ export const renderBenefit =
29
29
  </Text>,
30
30
  ];
31
31
  case 'rte':
32
- return <RichText __html={benefit.__html} />;
32
+ return (
33
+ <div className="col-span-2">
34
+ <RichText __html={benefit.__html} />
35
+ </div>
36
+ );
33
37
  default:
34
38
  assertUnreachable(benefit);
35
39
  }
@@ -2,7 +2,7 @@
2
2
  "content": {
3
3
  "listType": "vertical-list"
4
4
  },
5
- "style": ["col-span-12", "h-96"],
5
+ "style": ["col-span-12"],
6
6
  "type": "SwipeListControlBlock",
7
7
  "blocks": [
8
8
  {
@@ -41,4 +41,21 @@ export default {
41
41
  />
42
42
  </div>
43
43
  ),
44
+ transparent: (
45
+ <div className="container grid grid-cols-12 p-4">
46
+ <SwipeListControlBlock
47
+ className="col-span-12"
48
+ block={{
49
+ type: 'SwipeListControlBlock',
50
+ blocks: [
51
+ { type: 'ProductTile', content: { ...PRODUCT_TILE, version: '' } },
52
+ { type: 'ProductTile', content: { ...PRODUCT_TILE, version: '' } },
53
+ ],
54
+ }}
55
+ listType="vertical-list"
56
+ options={options}
57
+ version="transparent"
58
+ />
59
+ </div>
60
+ ),
44
61
  };