@redneckz/wildless-cms-uni-blocks 0.3.31 → 0.3.32

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 (105) hide show
  1. package/README.md +1 -1
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +54 -28
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/dist/components/MobileAppTile/MobileAppTile.js +1 -1
  6. package/dist/components/MobileAppTile/MobileAppTile.js.map +1 -1
  7. package/dist/components/PictureText/PictureText.js +8 -4
  8. package/dist/components/PictureText/PictureText.js.map +1 -1
  9. package/dist/components/PictureText/PictureTextContent.d.ts +7 -0
  10. package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
  11. package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
  12. package/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
  13. package/dist/components/Recommendation/Recommendation.js +1 -1
  14. package/dist/components/Recommendation/RecommendationCard.js +1 -1
  15. package/dist/components/Recommendation/RecommendationCard.js.map +1 -1
  16. package/dist/components/StepsBlock/StepsBlock.js +8 -2
  17. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  18. package/dist/components/StepsBlock/StepsBlock.mobile.js +10 -4
  19. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  20. package/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -2
  21. package/dist/ui-kit/Button/ButtonInner.js +1 -1
  22. package/dist/ui-kit/Button/ButtonInner.js.map +1 -1
  23. package/dist/ui-kit/Heading/Heading.js +1 -1
  24. package/dist/ui-kit/Heading/Heading.js.map +1 -1
  25. package/lib/common.css +1 -1
  26. package/lib/components/MobileAppTile/MobileAppTile.js +1 -1
  27. package/lib/components/MobileAppTile/MobileAppTile.js.map +1 -1
  28. package/lib/components/PictureText/PictureText.js +8 -4
  29. package/lib/components/PictureText/PictureText.js.map +1 -1
  30. package/lib/components/PictureText/PictureTextContent.d.ts +7 -0
  31. package/lib/components/ProductGalleryGreen/ProductGalleryGreen.fixture.d.ts +1 -0
  32. package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
  33. package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
  34. package/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
  35. package/lib/components/Recommendation/Recommendation.js +1 -1
  36. package/lib/components/Recommendation/RecommendationCard.js +1 -1
  37. package/lib/components/Recommendation/RecommendationCard.js.map +1 -1
  38. package/lib/components/StepsBlock/StepsBlock.fixture.d.ts +1 -0
  39. package/lib/components/StepsBlock/StepsBlock.js +8 -2
  40. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  41. package/lib/components/StepsBlock/StepsBlock.mobile.js +10 -4
  42. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  43. package/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -2
  44. package/lib/ui-kit/Button/ButtonInner.js +1 -1
  45. package/lib/ui-kit/Button/ButtonInner.js.map +1 -1
  46. package/lib/ui-kit/Heading/Heading.js +1 -1
  47. package/lib/ui-kit/Heading/Heading.js.map +1 -1
  48. package/mobile/bundle/bundle.umd.js +11 -5
  49. package/mobile/bundle/bundle.umd.min.js +1 -1
  50. package/mobile/dist/components/PictureText/PictureText.js +8 -4
  51. package/mobile/dist/components/PictureText/PictureText.js.map +1 -1
  52. package/mobile/dist/components/PictureText/PictureTextContent.d.ts +7 -0
  53. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
  54. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
  55. package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
  56. package/mobile/dist/components/Recommendation/Recommendation.js +1 -1
  57. package/mobile/dist/components/Recommendation/RecommendationCard.js +1 -1
  58. package/mobile/dist/components/Recommendation/RecommendationCard.js.map +1 -1
  59. package/mobile/dist/components/StepsBlock/StepsBlock.js +10 -4
  60. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  61. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -2
  62. package/mobile/dist/ui-kit/Button/ButtonInner.js +1 -1
  63. package/mobile/dist/ui-kit/Button/ButtonInner.js.map +1 -1
  64. package/mobile/lib/components/PictureText/PictureText.js +8 -4
  65. package/mobile/lib/components/PictureText/PictureText.js.map +1 -1
  66. package/mobile/lib/components/PictureText/PictureTextContent.d.ts +7 -0
  67. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
  68. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
  69. package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
  70. package/mobile/lib/components/Recommendation/Recommendation.js +1 -1
  71. package/mobile/lib/components/Recommendation/RecommendationCard.js +1 -1
  72. package/mobile/lib/components/Recommendation/RecommendationCard.js.map +1 -1
  73. package/mobile/lib/components/StepsBlock/StepsBlock.js +10 -4
  74. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  75. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -2
  76. package/mobile/lib/ui-kit/Button/ButtonInner.js +1 -1
  77. package/mobile/lib/ui-kit/Button/ButtonInner.js.map +1 -1
  78. package/mobile/src/components/PictureText/PictureText.example.json +2 -0
  79. package/mobile/src/components/PictureText/PictureText.tsx +33 -7
  80. package/mobile/src/components/PictureText/PictureTextContent.ts +7 -0
  81. package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.example.json +2 -1
  82. package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +40 -17
  83. package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreenContent.ts +2 -0
  84. package/mobile/src/components/Recommendation/Recommendation.tsx +1 -1
  85. package/mobile/src/components/Recommendation/RecommendationCard.tsx +1 -1
  86. package/mobile/src/components/StepsBlock/StepsBlock.tsx +14 -5
  87. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +3 -2
  88. package/mobile/src/ui-kit/Button/ButtonInner.tsx +2 -2
  89. package/package.json +2 -3
  90. package/src/components/MobileAppTile/MobileAppTile.tsx +3 -3
  91. package/src/components/PictureText/PictureText.example.json +2 -0
  92. package/src/components/PictureText/PictureText.tsx +33 -7
  93. package/src/components/PictureText/PictureTextContent.ts +7 -0
  94. package/src/components/ProductGalleryGreen/ProductGalleryGreen.example.json +2 -1
  95. package/src/components/ProductGalleryGreen/ProductGalleryGreen.fixture.tsx +74 -1
  96. package/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +40 -17
  97. package/src/components/ProductGalleryGreen/ProductGalleryGreenContent.ts +2 -0
  98. package/src/components/Recommendation/Recommendation.tsx +1 -1
  99. package/src/components/Recommendation/RecommendationCard.tsx +1 -1
  100. package/src/components/StepsBlock/StepsBlock.fixture.tsx +14 -0
  101. package/src/components/StepsBlock/StepsBlock.mobile.tsx +14 -5
  102. package/src/components/StepsBlock/StepsBlock.tsx +13 -6
  103. package/src/components/StepsBlock/StepsBlockContent.ts +3 -2
  104. package/src/ui-kit/Button/ButtonInner.tsx +2 -2
  105. package/src/ui-kit/Heading/Heading.tsx +1 -3
@@ -1,5 +1,6 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { UniBlockProps } from '../../types';
3
+ import type { BlockVersion } from '../../model/BlockVersion';
3
4
  import { Icon } from '../../ui-kit/Icon/Icon';
4
5
  import type { ProductBlockInnerContent } from '../ProductBlock/ProductBlockContent';
5
6
  import { ProductBlockInner } from '../ProductBlock/ProductBlockInner';
@@ -7,23 +8,39 @@ import type { ProductGalleryGreenContent } from './ProductGalleryGreenContent';
7
8
 
8
9
  export interface ProductGalleryProps extends ProductGalleryGreenContent, UniBlockProps {}
9
10
 
11
+ const productGalleryGreenStyleMap: Record<BlockVersion, string> = {
12
+ primary: 'bg-white text-primary-text',
13
+ secondary: 'bg-primary-main text-white',
14
+ };
15
+
16
+ const productBlockStyleMap: Record<BlockVersion, string> = {
17
+ primary: 'text-secondary-text',
18
+ secondary: 'text-white/80',
19
+ };
20
+
21
+ const productSlideStyleMap: Record<BlockVersion, string> = {
22
+ primary: 'bg-white text-primary-text',
23
+ secondary: 'bg-primary-main text-white',
24
+ };
25
+
10
26
  export const ProductGalleryGreen = JSX<ProductGalleryProps>(
11
- ({ className = '', context, slides = [], anchor = null }) => {
27
+ ({ className = '', context, slides = [], version = 'primary', duration = 0, anchor = null }) => {
12
28
  const galleryNav = slides.map((s) => s.nav);
13
29
  const galleryBlocks = slides.map((s) => s.productBlock);
14
30
  const [activeSlideIndex, setActiveSlideIndex] = context.useState(0);
15
31
 
16
32
  return (
17
33
  <section
18
- className={`box-border pt-[70px] relative font-sans overflow-hidden bg-primary-main w-100 ${className}`}
19
34
  id={anchor}
35
+ className={`box-border pt-[70px] overflow-hidden relative font-sans w-100 ${className}
36
+ ${productGalleryGreenStyleMap[version]}`}
20
37
  >
21
38
  <div
22
39
  className="flex duration-1000 pb-14"
23
40
  style={{ transform: `translateX(-${activeSlideIndex}00%)` }}
24
41
  role="list"
25
42
  >
26
- {galleryBlocks.map((_, i) => renderProductBlock(_, i, context))}
43
+ {galleryBlocks.map((_, i) => renderProductBlock({ ..._, version }, i, context))}
27
44
  </div>
28
45
 
29
46
  <div className="flex items-center absolute bottom-6 left-0 right-0 px-9 box-border">
@@ -33,6 +50,8 @@ export const ProductGalleryGreen = JSX<ProductGalleryProps>(
33
50
  i,
34
51
  activeSlideIndex,
35
52
  onClick: () => setActiveSlideIndex(i),
53
+ version,
54
+ duration,
36
55
  }),
37
56
  )}
38
57
  </div>
@@ -42,6 +61,9 @@ export const ProductGalleryGreen = JSX<ProductGalleryProps>(
42
61
  );
43
62
 
44
63
  function renderProductBlock(block: ProductBlockInnerContent, i: number, context) {
64
+ const { version } = block;
65
+ const additionalClass = version ? productBlockStyleMap[version] : '';
66
+
45
67
  return (
46
68
  <section
47
69
  key={String(i)}
@@ -55,10 +77,9 @@ function renderProductBlock(block: ProductBlockInnerContent, i: number, context)
55
77
  </div>
56
78
  ) : null}
57
79
  <ProductBlockInner
58
- className="pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem] z-[1]"
80
+ className={`pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem] z-[1] ${additionalClass}`}
59
81
  context={context}
60
82
  textBlockClassName="mb-[154px]"
61
- version="secondary"
62
83
  {...block}
63
84
  />
64
85
  <Icon
@@ -72,32 +93,34 @@ function renderProductBlock(block: ProductBlockInnerContent, i: number, context)
72
93
  );
73
94
  }
74
95
 
75
- function renderNavButton({ slide, i, activeSlideIndex, onClick }) {
96
+ function renderNavButton({ slide, i, activeSlideIndex, onClick, version, duration }) {
76
97
  const isActiveBtn = i === activeSlideIndex;
77
98
  const btnClassName = isActiveBtn
78
- ? 'bg-white shadow-dark-blue/42 h-[102px] w-[354px] min-w-[354px] max-w-[354px] p-0'
79
- : 'bg-white/10 min-w-[277px] px-0 pt-4 pb-[23px] hover:pt-[21px] hover:pb-7 ease-in duration-300';
80
- const btnTitleClassName = isActiveBtn
81
- ? 'text-[18px] text-primary-text pb-[10px]'
82
- : 'text-m-base text-white pb-[3px]';
83
- const btnDescClassName = isActiveBtn
84
- ? 'text-[18px] text-secondary-text'
85
- : 'text-m-base text-white';
86
-
99
+ ? 'bg-white shadow-dark-blue/42 h-[102px] w-[354px] min-w-[354px] max-w-[354px] p-0 border-none'
100
+ : `min-w-[277px] px-0 pt-4 pb-[23px] hover:py-[26px] hover:py-[26px] ease-in duration-300
101
+ ${productSlideStyleMap[version]}`;
102
+ const btnTitleClassName = isActiveBtn ? 'text-primary-text' : productBlockStyleMap[version];
103
+ const btnDescClassName = isActiveBtn ? 'text-secondary-text' : productBlockStyleMap[version];
104
+ const additionalBorder = version === 'secondary' ? 'border-white/50' : '';
105
+ const progressBarClassName = isActiveBtn ? 'animate-slide' : '';
87
106
  return (
88
107
  <button
89
108
  type="button"
90
109
  key={String(i)}
91
110
  onClick={onClick}
92
111
  aria-label={slide?.title}
93
- className={`box-border font-sans group relative overflow-hidden border-white/50 border-[1px] cursor-pointer text-left mb-6a mx-1 grow basis-0 backdrop-blur-sm
94
- ${btnClassName}
112
+ className={`box-border font-sans group relative overflow-hidden border-[1px] cursor-pointer text-left mx-1 grow basis-0 backdrop-blur-sm
113
+ ${btnClassName} ${additionalBorder}
95
114
  `}
96
115
  >
97
116
  <div className="border-0 px-6">
98
117
  <div className={`font-medium ${btnTitleClassName}`}>{slide?.title}</div>
99
118
  <div className={`text-secondary-text ${btnDescClassName}`}>{slide.description}</div>
100
119
  </div>
120
+ <div
121
+ className={`absolute bottom-0 left-0 w-full h-[3px] bg-primary-main -translate-x-full ${progressBarClassName}`}
122
+ style={{ animationDuration: `${duration}s`, animationFillMode: 'forwards' }}
123
+ ></div>
101
124
  </button>
102
125
  );
103
126
  }
@@ -1,4 +1,5 @@
1
1
  import type { ProductBlockInnerContent } from '../ProductBlock/ProductBlockContent';
2
+ import type { BlockVersion } from '../../model/BlockVersion';
2
3
 
3
4
  /** @title Кнопка под слайдом */
4
5
  interface ProductGalleryNav {
@@ -29,4 +30,5 @@ export interface ProductGalleryGreenContent {
29
30
  duration?: number;
30
31
  /** @title Слайды */
31
32
  slides?: ProductSlide[];
33
+ version?: BlockVersion;
32
34
  }
@@ -24,7 +24,7 @@ export const Recommendation = JSX<RecommendationProps>(
24
24
  className={`relative font-sans p-[50px] overflow-hidden ${blockClassName} ${className}`}
25
25
  id={anchor}
26
26
  >
27
- {title ? <Heading headingType="h3" className="mb-8" title={title} /> : null}
27
+ {title ? <Heading headingType="h2" className="mb-8" title={title} /> : null}
28
28
  <div
29
29
  className="flex duration-1000 gap-4"
30
30
  style={{ transform: `translateX(-${activeCardIndex * CARD_SHIFT}px)` }}
@@ -25,7 +25,7 @@ export const RecommendationCard = JSX<RecommendationCardProps>(
25
25
  image={image?.src && <Img className="mt-auto ml-7" image={image} />}
26
26
  >
27
27
  {description ? <Description description={description} /> : null}
28
- {items?.length ? <List items={items} version={version} /> : null}
28
+ {items?.length ? <List className="text-m-base" items={items} version={version} /> : null}
29
29
  </BaseTile>
30
30
  </section>
31
31
  );
@@ -14,10 +14,24 @@ const steps = [
14
14
  label: 'Получение наличных',
15
15
  description: 'Получите наличные в отделении банка',
16
16
  },
17
+ {
18
+ label: 'Последний шаг!',
19
+ description: 'Получите наличные в отделении банка',
20
+ },
17
21
  ];
18
22
 
19
23
  export default {
20
24
  default: (
25
+ <div className="container grid grid-cols-12">
26
+ <StepsBlock
27
+ className="col-span-12"
28
+ context={context}
29
+ title="Рассчитайте условия на онлайн-калькуляторе и оставьте заявку на потребительский кредит"
30
+ steps={steps.slice(0, 3)}
31
+ />
32
+ </div>
33
+ ),
34
+ '4 steps': (
21
35
  <div className="container grid grid-cols-12">
22
36
  <StepsBlock
23
37
  className="col-span-12"
@@ -16,6 +16,16 @@ type StyleType = {
16
16
  iconConnector: string;
17
17
  };
18
18
 
19
+ const STEPS_SIZE_MAP: Record<SizeVersion, string> = {
20
+ normal: 'h-[70px] w-[70px] min-w-[70px] min-h-[70px]',
21
+ small: 'h-[50px] w-[50px] min-w-[50px] min-h-[50px]',
22
+ };
23
+
24
+ const STEPS_TILE_DESCRIPTION_HEIGHT_MAP: Record<SizeVersion, string> = {
25
+ normal: 'min-h-[70px]',
26
+ small: 'min-h-[50px]',
27
+ };
28
+
19
29
  const STEPS_BLOCK_STYLE_MAPS: Record<BlockVersion, StyleType> = {
20
30
  primary: {
21
31
  background: 'bg-white',
@@ -88,7 +98,9 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
88
98
  <div className={`min-h-8 h-full w-[2px] ${style.iconConnector} ${margin}`} />
89
99
  )}
90
100
  </div>
91
- <div className="flex flex-col justify-start relative">
101
+ <div
102
+ className={`flex flex-col justify-center h-fit ${STEPS_TILE_DESCRIPTION_HEIGHT_MAP[size]}`}
103
+ >
92
104
  {step.label && (
93
105
  <div className="font-medium text-m-title-xs m-0 text-left">{step.label}</div>
94
106
  )}
@@ -110,10 +122,7 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
110
122
  const renderIconArea = (params: RenderStepTitleParams) => {
111
123
  const { step, size, i, version } = params;
112
124
  const style = styleMaps(version);
113
- const iconAreaSize =
114
- size === 'normal'
115
- ? 'h-[70px] w-[70px] min-w-[70px] min-h-[70px]'
116
- : 'h-[50px] w-[50px] min-w-[50px] min-h-[50px]';
125
+ const iconAreaSize = STEPS_SIZE_MAP[size];
117
126
 
118
127
  const iconSize = size === 'normal' ? '38' : '27';
119
128
  const iconTextSize = size === 'normal' ? 'text-m-title' : 'text-m-title-xs';
@@ -8,12 +8,17 @@ import type { Step, StepsBlockContent } from './StepsBlockContent';
8
8
  export interface StepsBlockProps extends StepsBlockContent, UniBlockProps {}
9
9
 
10
10
  export const StepsBlock = JSX<StepsBlockProps>(
11
- ({ className, title, showLines = true, steps, anchor = null }) => {
11
+ ({ className = '', title, showLines = true, steps = [], anchor = null }) => {
12
+ const shortGaps = steps.length > 3;
13
+
12
14
  return (
13
15
  <section
14
- className={`box-border font-sans text-primary-text bg-white px-20 py-[50px] flex flex-col items-center ${
15
- className || ''
16
- }`}
16
+ className={[
17
+ 'box-border font-sans text-primary-text bg-white',
18
+ shortGaps ? 'px-20' : 'px-[70px]',
19
+ 'py-[50px] flex flex-col items-center',
20
+ className,
21
+ ].join(' ')}
17
22
  id={anchor}
18
23
  >
19
24
  <Heading headingType="h2" className="max-w-[47rem] text-center" title={title} />
@@ -24,9 +29,11 @@ export const StepsBlock = JSX<StepsBlockProps>(
24
29
  <div
25
30
  className={`h-0.5 w-full bg-secondary-light ${!showLines ? 'opacity-0' : ''}`}
26
31
  />,
27
- )(steps.map((step, i) => renderStepIcon(step, i)))}
32
+ )(steps.map(renderStepIcon))}
33
+ </div>
34
+ <div className={`flex justify-between ${shortGaps ? 'gap-x-3' : 'gap-x-[101px]'}`}>
35
+ {steps.map(renderStepTitle)}
28
36
  </div>
29
- <div className="flex justify-between gap-x-[101px]">{steps.map(renderStepTitle)}</div>
30
37
  </div>
31
38
  ) : null}
32
39
  </section>
@@ -1,4 +1,4 @@
1
- import type { IconName } from '../../ui-kit/Icon/IconProps';
1
+ import type { IconName } from '../../icons/IconName';
2
2
  import type { SizeVersion } from '../../model/SizeVersion';
3
3
  import type { BlockVersion } from '../../model/BlockVersion';
4
4
 
@@ -26,9 +26,10 @@ export interface StepsBlockContent {
26
26
  /**
27
27
  * @title Шаги
28
28
  * @minItems 2
29
- * @maxItems 3
29
+ * @maxItems 4
30
30
  */
31
31
  steps?: Step[];
32
+ /** @title Размер шагов (моб.) */
32
33
  size?: SizeVersion; // TODO: mobile content
33
34
  version?: BlockVersion; // TODO: mobile content
34
35
  }
@@ -13,8 +13,8 @@ export const ButtonInner = JSX<ButtonInnerProps>((props) => {
13
13
  {appendLeft ? appendLeft : null}
14
14
  {isWithText(props) ? (
15
15
  <div>
16
- <div className="text-m-2xs text-left">{aboveText}</div>
17
- <div className="text-m-button font-medium text-left">{text}</div>
16
+ <div className="text-m-2xs font-light text-left">{aboveText}</div>
17
+ <div className="text-m-button text-left">{text}</div>
18
18
  </div>
19
19
  ) : null}
20
20
  </div>
@@ -22,8 +22,6 @@ export const Heading = JSX<HeadingProps>((props) => {
22
22
  const Tag = headingType;
23
23
 
24
24
  return (
25
- <Tag className={`font-sans font-medium m-0 ${HEADING_STYLE_MAP[headingType]} ${className}`}>
26
- {title}
27
- </Tag>
25
+ <Tag className={`font-sans m-0 ${HEADING_STYLE_MAP[headingType]} ${className}`}>{title}</Tag>
28
26
  );
29
27
  });