@redneckz/wildless-cms-uni-blocks 0.2.72 → 0.2.75

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 (211) hide show
  1. package/bundle/blocks.schema.json +240 -151
  2. package/bundle/bundle.umd.js +124 -44
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/BaseTile.js +9 -4
  5. package/dist/BaseTile.js.map +1 -1
  6. package/dist/BaseTileContent.d.ts +2 -2
  7. package/dist/BlockContent.d.ts +2 -1
  8. package/dist/Blocks.d.ts +2 -0
  9. package/dist/Blocks.js +4 -0
  10. package/dist/Blocks.js.map +1 -1
  11. package/dist/ComparisonTable/ComparisonTable.d.ts +5 -0
  12. package/dist/ComparisonTable/ComparisonTable.js +34 -0
  13. package/dist/ComparisonTable/ComparisonTable.js.map +1 -0
  14. package/dist/ComparisonTable/ComparisonTableContent.d.ts +37 -0
  15. package/dist/ComparisonTable/ComparisonTableContent.js +2 -0
  16. package/dist/ComparisonTable/ComparisonTableContent.js.map +1 -0
  17. package/dist/ComparisonTable/HeaderCell.d.ts +10 -0
  18. package/dist/ComparisonTable/HeaderCell.js +11 -0
  19. package/dist/ComparisonTable/HeaderCell.js.map +1 -0
  20. package/dist/ComparisonTable/TableCarouselContainer.d.ts +4 -0
  21. package/dist/ComparisonTable/TableCarouselContainer.js +7 -0
  22. package/dist/ComparisonTable/TableCarouselContainer.js.map +1 -0
  23. package/dist/ComparisonTable/TableCell.d.ts +8 -0
  24. package/dist/ComparisonTable/TableCell.js +12 -0
  25. package/dist/ComparisonTable/TableCell.js.map +1 -0
  26. package/dist/ComparisonTable/TableRow.d.ts +10 -0
  27. package/dist/ComparisonTable/TableRow.js +10 -0
  28. package/dist/ComparisonTable/TableRow.js.map +1 -0
  29. package/dist/ComparisonTable/TableRowContainer.d.ts +4 -0
  30. package/dist/ComparisonTable/TableRowContainer.js +6 -0
  31. package/dist/ComparisonTable/TableRowContainer.js.map +1 -0
  32. package/dist/ComparisonTable/constants.d.ts +6 -0
  33. package/dist/ComparisonTable/constants.js +9 -0
  34. package/dist/ComparisonTable/constants.js.map +1 -0
  35. package/dist/ComparisonTable/index.d.ts +3 -0
  36. package/dist/ComparisonTable/index.js +5 -0
  37. package/dist/ComparisonTable/index.js.map +1 -0
  38. package/dist/ExchangeRateTile.js +1 -0
  39. package/dist/ExchangeRateTile.js.map +1 -1
  40. package/dist/Footer/Contacts.js +1 -1
  41. package/dist/Footer/Contacts.js.map +1 -1
  42. package/dist/Footer/SocialMedia.js +4 -1
  43. package/dist/Footer/SocialMedia.js.map +1 -1
  44. package/dist/Gallery.d.ts +1 -1
  45. package/dist/Gallery.js +2 -32
  46. package/dist/Gallery.js.map +1 -1
  47. package/dist/Gallery.mobile.js +1 -1
  48. package/dist/Gallery.mobile.js.map +1 -1
  49. package/dist/GalleryInner.d.ts +7 -0
  50. package/dist/GalleryInner.js +46 -0
  51. package/dist/GalleryInner.js.map +1 -0
  52. package/dist/MiniGallery.d.ts +5 -0
  53. package/dist/MiniGallery.js +7 -0
  54. package/dist/MiniGallery.js.map +1 -0
  55. package/dist/ProductBlockInner.js +3 -3
  56. package/dist/ProductBlockInner.js.map +1 -1
  57. package/dist/TextBlock.js +4 -4
  58. package/dist/TextBlock.js.map +1 -1
  59. package/dist/model/GalleryVersion.d.ts +1 -0
  60. package/dist/{ui-kit/IconButtonProps.js → model/GalleryVersion.js} +1 -1
  61. package/dist/model/GalleryVersion.js.map +1 -0
  62. package/dist/ui-kit/ArrowButton.d.ts +2 -6
  63. package/dist/ui-kit/ArrowButton.js +17 -3
  64. package/dist/ui-kit/ArrowButton.js.map +1 -1
  65. package/dist/ui-kit/Button.d.ts +2 -1
  66. package/dist/ui-kit/Button.js +11 -5
  67. package/dist/ui-kit/Button.js.map +1 -1
  68. package/dist/ui-kit/ButtonProps.d.ts +15 -3
  69. package/dist/ui-kit/IconProps.d.ts +23 -1
  70. package/dist/ui-kit/IconProps.js +24 -0
  71. package/dist/ui-kit/IconProps.js.map +1 -1
  72. package/dist/{Img.d.ts → ui-kit/Img.d.ts} +1 -1
  73. package/dist/{Img.js → ui-kit/Img.js} +0 -0
  74. package/dist/ui-kit/Img.js.map +1 -0
  75. package/dist/ui-kit/SVG.d.ts +2 -0
  76. package/dist/ui-kit/SVG.js +2 -2
  77. package/dist/ui-kit/SVG.js.map +1 -1
  78. package/lib/BaseTile.js +9 -4
  79. package/lib/BaseTile.js.map +1 -1
  80. package/lib/BaseTileContent.d.ts +2 -2
  81. package/lib/BlockContent.d.ts +2 -1
  82. package/lib/Blocks.d.ts +2 -0
  83. package/lib/Blocks.js +4 -0
  84. package/lib/Blocks.js.map +1 -1
  85. package/lib/ComparisonTable/ComparisonTable.d.ts +5 -0
  86. package/lib/ComparisonTable/ComparisonTable.js +32 -0
  87. package/lib/ComparisonTable/ComparisonTable.js.map +1 -0
  88. package/lib/ComparisonTable/ComparisonTableContent.d.ts +37 -0
  89. package/lib/ComparisonTable/ComparisonTableContent.js +2 -0
  90. package/lib/ComparisonTable/ComparisonTableContent.js.map +1 -0
  91. package/lib/ComparisonTable/HeaderCell.d.ts +10 -0
  92. package/lib/ComparisonTable/HeaderCell.js +9 -0
  93. package/lib/ComparisonTable/HeaderCell.js.map +1 -0
  94. package/lib/ComparisonTable/TableCarouselContainer.d.ts +4 -0
  95. package/lib/ComparisonTable/TableCarouselContainer.js +5 -0
  96. package/lib/ComparisonTable/TableCarouselContainer.js.map +1 -0
  97. package/lib/ComparisonTable/TableCell.d.ts +8 -0
  98. package/lib/ComparisonTable/TableCell.js +10 -0
  99. package/lib/ComparisonTable/TableCell.js.map +1 -0
  100. package/lib/ComparisonTable/TableRow.d.ts +10 -0
  101. package/lib/ComparisonTable/TableRow.js +8 -0
  102. package/lib/ComparisonTable/TableRow.js.map +1 -0
  103. package/lib/ComparisonTable/TableRowContainer.d.ts +4 -0
  104. package/lib/ComparisonTable/TableRowContainer.js +4 -0
  105. package/lib/ComparisonTable/TableRowContainer.js.map +1 -0
  106. package/lib/ComparisonTable/constants.d.ts +6 -0
  107. package/lib/ComparisonTable/constants.js +7 -0
  108. package/lib/ComparisonTable/constants.js.map +1 -0
  109. package/lib/ComparisonTable/index.d.ts +3 -0
  110. package/lib/ComparisonTable/index.js +2 -0
  111. package/lib/ComparisonTable/index.js.map +1 -0
  112. package/lib/ExchangeRateTile.js +1 -0
  113. package/lib/ExchangeRateTile.js.map +1 -1
  114. package/lib/Footer/Contacts.js +1 -1
  115. package/lib/Footer/Contacts.js.map +1 -1
  116. package/lib/Footer/SocialMedia.js +4 -1
  117. package/lib/Footer/SocialMedia.js.map +1 -1
  118. package/lib/Gallery.d.ts +1 -1
  119. package/lib/Gallery.js +3 -33
  120. package/lib/Gallery.js.map +1 -1
  121. package/lib/Gallery.mobile.js +1 -1
  122. package/lib/Gallery.mobile.js.map +1 -1
  123. package/lib/GalleryInner.d.ts +7 -0
  124. package/lib/GalleryInner.js +44 -0
  125. package/lib/GalleryInner.js.map +1 -0
  126. package/lib/MiniGallery.d.ts +5 -0
  127. package/lib/MiniGallery.js +5 -0
  128. package/lib/MiniGallery.js.map +1 -0
  129. package/lib/ProductBlockInner.js +3 -3
  130. package/lib/ProductBlockInner.js.map +1 -1
  131. package/lib/TextBlock.js +4 -4
  132. package/lib/TextBlock.js.map +1 -1
  133. package/lib/common.css +1 -1
  134. package/lib/model/GalleryVersion.d.ts +1 -0
  135. package/lib/model/GalleryVersion.js +2 -0
  136. package/lib/model/GalleryVersion.js.map +1 -0
  137. package/lib/ui-kit/ArrowButton.d.ts +2 -6
  138. package/lib/ui-kit/ArrowButton.js +18 -4
  139. package/lib/ui-kit/ArrowButton.js.map +1 -1
  140. package/lib/ui-kit/Button.d.ts +2 -1
  141. package/lib/ui-kit/Button.js +11 -5
  142. package/lib/ui-kit/Button.js.map +1 -1
  143. package/lib/ui-kit/ButtonProps.d.ts +15 -3
  144. package/lib/ui-kit/IconProps.d.ts +23 -1
  145. package/lib/ui-kit/IconProps.js +23 -1
  146. package/lib/ui-kit/IconProps.js.map +1 -1
  147. package/lib/{Img.d.ts → ui-kit/Img.d.ts} +1 -1
  148. package/lib/{Img.js → ui-kit/Img.js} +0 -0
  149. package/lib/ui-kit/Img.js.map +1 -0
  150. package/lib/ui-kit/SVG.d.ts +2 -0
  151. package/lib/ui-kit/SVG.js +2 -2
  152. package/lib/ui-kit/SVG.js.map +1 -1
  153. package/package.json +1 -1
  154. package/src/BaseTile.tsx +17 -5
  155. package/src/BaseTileContent.ts +2 -2
  156. package/src/BlockContent.ts +3 -1
  157. package/src/Blocks.ts +4 -0
  158. package/src/ComparisonTable/ComparisonTable.fixture.tsx +265 -0
  159. package/src/ComparisonTable/ComparisonTable.tsx +126 -0
  160. package/src/ComparisonTable/ComparisonTableContent.ts +43 -0
  161. package/src/ComparisonTable/HeaderCell.tsx +50 -0
  162. package/src/ComparisonTable/TableCarouselContainer.tsx +19 -0
  163. package/src/ComparisonTable/TableCell.tsx +43 -0
  164. package/src/ComparisonTable/TableRow.tsx +44 -0
  165. package/src/ComparisonTable/TableRowContainer.tsx +7 -0
  166. package/src/ComparisonTable/constants.ts +6 -0
  167. package/src/ComparisonTable/index.ts +3 -0
  168. package/src/ContentPage.page.json +463 -1
  169. package/src/ExchangeRateTile.tsx +2 -1
  170. package/src/Footer/Contacts.tsx +1 -0
  171. package/src/Footer/SocialMedia.tsx +9 -5
  172. package/src/Gallery.fixture.tsx +1 -1
  173. package/src/Gallery.mobile.tsx +1 -1
  174. package/src/Gallery.tsx +3 -119
  175. package/src/GalleryInner.tsx +135 -0
  176. package/src/MiniGallery.fixture.tsx +90 -0
  177. package/src/MiniGallery.tsx +10 -0
  178. package/src/ProductBlock.fixture.tsx +1 -1
  179. package/src/ProductBlockInner.tsx +3 -3
  180. package/src/ProductTile.fixture.tsx +1 -1
  181. package/src/TextBlock.fixture.tsx +1 -1
  182. package/src/TextBlock.tsx +6 -4
  183. package/src/Tile.fixture.tsx +1 -1
  184. package/src/common.css +36 -0
  185. package/src/icons/AppleIcon.svg +1 -13
  186. package/src/icons/GlassIcon.svg +1 -0
  187. package/src/icons/PlayMarketIcon.svg +1 -6
  188. package/src/model/GalleryVersion.ts +1 -0
  189. package/src/ui-kit/ArrowButton.tsx +29 -30
  190. package/src/ui-kit/Button.fixture.tsx +33 -5
  191. package/src/ui-kit/Button.tsx +41 -17
  192. package/src/ui-kit/ButtonProps.ts +17 -3
  193. package/src/ui-kit/Icon.fixture.tsx +22 -0
  194. package/src/ui-kit/IconProps.ts +24 -21
  195. package/src/{Img.tsx → ui-kit/Img.tsx} +1 -1
  196. package/src/ui-kit/SVG.tsx +11 -2
  197. package/dist/Img.js.map +0 -1
  198. package/dist/ui-kit/IconButton.d.ts +0 -2
  199. package/dist/ui-kit/IconButton.js +0 -10
  200. package/dist/ui-kit/IconButton.js.map +0 -1
  201. package/dist/ui-kit/IconButtonProps.d.ts +0 -6
  202. package/dist/ui-kit/IconButtonProps.js.map +0 -1
  203. package/lib/Img.js.map +0 -1
  204. package/lib/ui-kit/IconButton.d.ts +0 -2
  205. package/lib/ui-kit/IconButton.js +0 -8
  206. package/lib/ui-kit/IconButton.js.map +0 -1
  207. package/lib/ui-kit/IconButtonProps.d.ts +0 -6
  208. package/lib/ui-kit/IconButtonProps.js +0 -2
  209. package/lib/ui-kit/IconButtonProps.js.map +0 -1
  210. package/src/ui-kit/IconButton.tsx +0 -22
  211. package/src/ui-kit/IconButtonProps.ts +0 -7
@@ -2,7 +2,7 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { ExchangeRateTileContent } from './ExchangeRateTileContent';
3
3
  import { Tile } from './Tile';
4
4
  import type { UniBlockProps } from './types';
5
- import { ButtonProps } from './ui-kit/ButtonProps';
5
+ import type { ButtonProps } from './ui-kit/ButtonProps';
6
6
  import { Icon } from './ui-kit/Icon';
7
7
 
8
8
  export interface ExchangeRateTileProps extends ExchangeRateTileContent, UniBlockProps {}
@@ -19,6 +19,7 @@ const buttons: ButtonProps[] = [
19
19
  {
20
20
  text: 'Все показатели',
21
21
  href: 'https://cbr.ru/currency_base/daily/',
22
+ version: 'secondary',
22
23
  },
23
24
  ];
24
25
 
@@ -18,6 +18,7 @@ export const Contacts = JSX<ContactsProps>(({ className, items, hasButton, conte
18
18
  {items?.length ? items.map(renderContact) : null}
19
19
  {hasButton ? (
20
20
  <Button
21
+ version="primary"
21
22
  className="my-4"
22
23
  {...useLink(
23
24
  { router, handlerDecorator },
@@ -4,6 +4,7 @@ import type { UniBlockProps } from '../types';
4
4
  import { Icon } from '../ui-kit/Icon';
5
5
  import type { IconName } from '../ui-kit/IconProps';
6
6
  import { useLink } from '../useLink';
7
+ import { Button } from '../ui-kit/Button';
7
8
 
8
9
  const ICONS_MAP: Array<{ origins: string[]; icon: IconName; label: string }> = [
9
10
  { origins: ['t.me', 'telegram.org'], icon: 'TelegramIcon', label: 'Телеграм' },
@@ -34,15 +35,18 @@ interface MediaButtonProps {
34
35
  const MediaButton = JSX<MediaButtonProps>(({ href }) => {
35
36
  const { icon, label } =
36
37
  ICONS_MAP.find(({ origins }) => origins.some((_) => href?.includes(_))) || {};
38
+
39
+ if (!icon) return null;
40
+
37
41
  return (
38
- <a
39
- className="flex items-center justify-center border-solid border border-main-divider rounded-full no-underline outline-none w-9 h-9"
42
+ <Button
43
+ rounded
40
44
  href={href}
41
45
  target="_blank"
42
46
  rel="noopener noreferrer"
43
47
  aria-label={label}
44
- >
45
- {icon && <Icon className="block" name={icon} /> /* TODO width & height */}
46
- </a>
48
+ className="border-solid border border-main-divider w-9 h-9 flex items-center justify-center hover:text-primary-main"
49
+ appendLeft={<Icon name={icon} />}
50
+ />
47
51
  );
48
52
  });
@@ -2,7 +2,7 @@ import { context } from './setup-fixture';
2
2
 
3
3
  import { Gallery, GalleryProps } from './Gallery';
4
4
  import { Gallery as MobileGallery } from './Gallery.mobile';
5
- import { Picture } from './model/Picture';
5
+ import type { Picture } from './model/Picture';
6
6
 
7
7
  const image: Picture = {
8
8
  src: 'money-1.png',
@@ -1,9 +1,9 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { GalleryProps } from './Gallery';
3
3
  import type { GalleryCard } from './GalleryContent';
4
- import { Img } from './Img';
5
4
  import { BlockItem } from './ui-kit/BlockItem';
6
5
  import { Button } from './ui-kit/Button';
6
+ import { Img } from './ui-kit/Img';
7
7
  import { Title } from './ui-kit/Title';
8
8
 
9
9
  export const Gallery = JSX<GalleryProps>(({ title, description, cards = [], className }) => {
package/src/Gallery.tsx CHANGED
@@ -1,124 +1,8 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { GalleryCard, GalleryContent } from './GalleryContent';
3
- import { Img } from './Img';
2
+ import { GalleryContent } from './GalleryContent';
3
+ import { GalleryInner } from './GalleryInner';
4
4
  import { UniBlockProps } from './types';
5
- import { ArrowButton } from './ui-kit/ArrowButton';
6
- import { BlockItem } from './ui-kit/BlockItem';
7
- import { Button } from './ui-kit/Button';
8
- import { Title } from './ui-kit/Title';
9
5
 
10
6
  export interface GalleryProps extends GalleryContent, UniBlockProps {}
11
7
 
12
- const CARD_WIDTH = 384;
13
- const GALLERY_LENGTH_FOR_SCROLL = 3;
14
-
15
- export const Gallery = JSX<GalleryProps>(
16
- ({ title, description, context, cards = [], className }) => {
17
- const [activeCardIndex, setActiveCardIndex] = context.useState(0);
18
-
19
- function handleNextClick() {
20
- setActiveCardIndex(activeCardIndex + 1);
21
- }
22
-
23
- function handlePrevClick() {
24
- setActiveCardIndex(activeCardIndex - 1);
25
- }
26
-
27
- const isGalleryScrollAvailable = cards?.length > GALLERY_LENGTH_FOR_SCROLL;
28
-
29
- const showNextButton =
30
- isGalleryScrollAvailable && cards?.length - activeCardIndex > GALLERY_LENGTH_FOR_SCROLL;
31
-
32
- const showPrevButton = isGalleryScrollAvailable && activeCardIndex > 0;
33
-
34
- return (
35
- <section
36
- className={`relative font-sans text-primary-text bg-white p-12 overflow-hidden ${className}`}
37
- >
38
- <div className="flex flex-col items-center mb-8">
39
- <Title className="font-medium m-0 text-centers">{title}</Title>
40
- {description ? (
41
- <div className="font-normal text-base max-w-[600px] mt-3">{description}</div>
42
- ) : null}
43
- </div>
44
- <div
45
- // Need to place all cards at the center if count of cards less than 4
46
- className={`flex ${
47
- cards?.length <= GALLERY_LENGTH_FOR_SCROLL ? 'justify-center' : ''
48
- } duration-1000`}
49
- // All cards has same width
50
- style={{ transform: `translateX(-${activeCardIndex * CARD_WIDTH}px)` }}
51
- role="list"
52
- >
53
- {cards?.map(renderCard)}
54
- </div>
55
- {showPrevButton && (
56
- <ArrowButton
57
- className="absolute top-1/2 left-8"
58
- onClick={handlePrevClick}
59
- ariaLabel="Пролистать влево"
60
- />
61
- )}
62
- {showNextButton && (
63
- <ArrowButton
64
- className="absolute top-1/2 right-1 z-20 rotate-180"
65
- onClick={handleNextClick}
66
- ariaLabel="Пролистать вправо"
67
- />
68
- )}
69
- <div
70
- className="absolute top-0 right-0 bottom-0 w-[84px]"
71
- style={{
72
- background: 'linear-gradient(270deg, #FFFFFF 34.89%, rgba(255, 255, 255, 0) 92.52%)',
73
- }}
74
- ></div>
75
- </section>
76
- );
77
- },
78
- );
79
-
80
- function renderCard(card: GalleryCard, key: number) {
81
- return (
82
- <div
83
- className="box-border border-solid border rounded-md border-main-divider p-7 mx-2 flex flex-col justify-between items-stretch min-w-[364px] w-[364px] w-full"
84
- role="listitem"
85
- key={key}
86
- >
87
- <div>
88
- {card.image?.src ? (
89
- <div className="flex justify-center">
90
- <Img className="mb-6" image={card.image} />
91
- </div>
92
- ) : null}
93
- {card.title ? (
94
- <h4
95
- className={`font-medium text-xl m-0 ${
96
- !card.description && !card.items?.length ? 'text-center' : ''
97
- }`}
98
- >
99
- {card.title}
100
- </h4>
101
- ) : null}
102
- {card.description ? (
103
- <div className="font-normal text-sm text-secondary-text mt-2">{card.description}</div>
104
- ) : null}
105
- {card.items?.length ? renderItems(card.items) : null}
106
- </div>
107
- {card.href ? (
108
- <Button className="mt-6" text="Подробнее" version="secondary" href={card.href} />
109
- ) : null}
110
- </div>
111
- );
112
- }
113
-
114
- function renderItems(items: string[] = []) {
115
- return (
116
- <section className="max-w-[308px] mt-2" role="list">
117
- {items.map((item, i) => (
118
- <BlockItem key={String(i)}>
119
- <span className="text-sm text-secondary-text">{item}</span>
120
- </BlockItem>
121
- ))}
122
- </section>
123
- );
124
- }
8
+ export const Gallery = JSX<GalleryProps>((props) => <GalleryInner {...props} version="normal" />);
@@ -0,0 +1,135 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { GalleryCard, GalleryContent } from './GalleryContent';
3
+ import type { GalleryVersion } from './model/GalleryVersion';
4
+ import type { UniBlockProps } from './types';
5
+ import { ArrowButton } from './ui-kit/ArrowButton';
6
+ import { BlockItem } from './ui-kit/BlockItem';
7
+ import { Button } from './ui-kit/Button';
8
+ import { Img } from './ui-kit/Img';
9
+ import { Title } from './ui-kit/Title';
10
+
11
+ export interface GalleryInnerProps extends GalleryContent, UniBlockProps {
12
+ version?: GalleryVersion;
13
+ }
14
+
15
+ const cardStyleMap: Record<GalleryVersion, string> = {
16
+ normal: 'min-w-[364px] w-[364px]',
17
+ mini: 'min-w-[260px] w-[260px]',
18
+ };
19
+
20
+ const cardWidthMap: Record<GalleryVersion, number> = {
21
+ normal: 380,
22
+ mini: 276,
23
+ };
24
+
25
+ const galleryLengthForScrollMap: Record<GalleryVersion, number> = {
26
+ normal: 3,
27
+ mini: 4,
28
+ };
29
+
30
+ export const GalleryInner = JSX<GalleryInnerProps>(
31
+ ({ title, description, context, cards = [], className, version = 'normal' }) => {
32
+ const [activeCardIndex, setActiveCardIndex] = context.useState(0);
33
+
34
+ function handleNextClick() {
35
+ setActiveCardIndex(activeCardIndex + 1);
36
+ }
37
+
38
+ function handlePrevClick() {
39
+ setActiveCardIndex(activeCardIndex - 1);
40
+ }
41
+
42
+ const isGalleryScrollAvailable = cards?.length > galleryLengthForScrollMap[version];
43
+
44
+ const showNextButton =
45
+ isGalleryScrollAvailable &&
46
+ cards?.length - activeCardIndex > galleryLengthForScrollMap[version];
47
+
48
+ const showPrevButton = isGalleryScrollAvailable && activeCardIndex > 0;
49
+
50
+ return (
51
+ <section
52
+ className={`relative font-sans text-primary-text bg-white p-12 overflow-hidden ${className}`}
53
+ >
54
+ <div className="flex flex-col items-center mb-8">
55
+ {title ? <Title className="font-medium m-0 text-center">{title}</Title> : null}
56
+ {description ? (
57
+ <div className="font-normal text-base max-w-[600px] mt-3">{description}</div>
58
+ ) : null}
59
+ </div>
60
+ <div
61
+ // Need to place all cards at the center if count of cards less than 4
62
+ className={`flex ${
63
+ cards?.length <= galleryLengthForScrollMap[version] ? 'justify-center' : ''
64
+ } duration-1000`}
65
+ // All cards has same width
66
+ style={{ transform: `translateX(-${activeCardIndex * cardWidthMap[version]}px)` }}
67
+ role="list"
68
+ >
69
+ {cards?.map((card, i) => renderCard(card, i, version))}
70
+ </div>
71
+ {showPrevButton && (
72
+ <ArrowButton
73
+ className="absolute top-1/2 left-8 rotate-180"
74
+ onClick={handlePrevClick}
75
+ ariaLabel="Пролистать влево"
76
+ />
77
+ )}
78
+ {showNextButton && (
79
+ <ArrowButton
80
+ className="absolute top-1/2 right-1 z-10"
81
+ onClick={handleNextClick}
82
+ ariaLabel="Пролистать вправо"
83
+ />
84
+ )}
85
+ <div className="absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white"></div>
86
+ </section>
87
+ );
88
+ },
89
+ );
90
+
91
+ function renderCard(card: GalleryCard, i: number, version: GalleryVersion) {
92
+ return (
93
+ <div
94
+ className={`box-border border-solid border rounded-md border-main-divider p-7 mx-2 flex flex-col justify-between items-stretch ${cardStyleMap[version]} w-full`}
95
+ role="listitem"
96
+ key={String(i)}
97
+ >
98
+ <div>
99
+ {card.image?.src ? (
100
+ <div className="flex justify-center">
101
+ <Img className="mb-6" image={card.image} />
102
+ </div>
103
+ ) : null}
104
+ {card.title ? (
105
+ <h4
106
+ className={`font-medium text-xl m-0 ${
107
+ !card.description && !card.items?.length ? 'text-center' : ''
108
+ }`}
109
+ >
110
+ {card.title}
111
+ </h4>
112
+ ) : null}
113
+ {card.description ? (
114
+ <div className="font-normal text-sm text-secondary-text mt-2">{card.description}</div>
115
+ ) : null}
116
+ {card.items?.length ? (
117
+ <section className="max-w-[308px] mt-2" role="list">
118
+ {card.items.map(renderItem)}
119
+ </section>
120
+ ) : null}
121
+ </div>
122
+ {card.href ? (
123
+ <Button className="mt-6" text="Подробнее" version="secondary" href={card.href} />
124
+ ) : null}
125
+ </div>
126
+ );
127
+ }
128
+
129
+ function renderItem(item: string, i: number) {
130
+ return (
131
+ <BlockItem key={String(i)}>
132
+ <span className="text-sm text-secondary-text">{item}</span>
133
+ </BlockItem>
134
+ );
135
+ }
@@ -0,0 +1,90 @@
1
+ import { context } from './setup-fixture';
2
+
3
+ import { MiniGallery, MiniGalleryProps } from './MiniGallery';
4
+ import { Picture } from './model/Picture';
5
+
6
+ const image: Picture = {
7
+ src: 'domovoj-kupon.png',
8
+ format: 'webp',
9
+ size: {
10
+ width: 120,
11
+ height: 70,
12
+ },
13
+ };
14
+
15
+ const defaultProps: MiniGalleryProps = {
16
+ title: 'Вы можете оплатить бонусными баллами',
17
+ description: 'Удобный каталог с большим ассортиментом товаров и сервисов',
18
+ context,
19
+ cards: [
20
+ {
21
+ title: 'Более 5000 товаров',
22
+ description:
23
+ 'Время копить: ставка растет в зависимости от срока нахождения средств на Счете!',
24
+ image,
25
+ },
26
+ {
27
+ title: 'Более 1000 развлечений',
28
+ description: 'Порядок и условия предоставления в соответствии с 106 ФЗ',
29
+ image,
30
+ },
31
+ {
32
+ title: 'Фермерские продукты',
33
+ description: 'Высокий процент даже при небольшой сумме денежных средств',
34
+ image,
35
+ },
36
+ {
37
+ title: '«Моя выгода»',
38
+ description:
39
+ 'Время копить: ставка растет в зависимости от срока нахождения средств на Счете!',
40
+ image,
41
+ },
42
+ {
43
+ title: 'Фермерские продукты',
44
+ description: 'Высокий процент даже при небольшой сумме денежных средств',
45
+ image,
46
+ },
47
+ {
48
+ title: 'Фермерские продукты',
49
+ description: 'Высокий процент даже при небольшой сумме денежных средств',
50
+ image,
51
+ },
52
+ ],
53
+ };
54
+
55
+ const onlyTitleProps: MiniGalleryProps = {
56
+ title: 'Вы можете оплатить бонусными баллами',
57
+ description: 'Удобный каталог с большим ассортиментом товаров и сервисов',
58
+ context,
59
+ cards: [
60
+ {
61
+ title: 'Более 5000 товаров',
62
+ image,
63
+ },
64
+ {
65
+ title: 'Более 1000 развлечений',
66
+ image,
67
+ },
68
+ {
69
+ title: 'Фермерские продукты',
70
+ image,
71
+ },
72
+ {
73
+ title: '«Моя выгода»',
74
+ image,
75
+ },
76
+ {
77
+ title: 'Фермерские продукты',
78
+ image,
79
+ },
80
+ {
81
+ title: 'Фермерские продукты',
82
+ image,
83
+ },
84
+ ],
85
+ };
86
+
87
+ export default {
88
+ default: <MiniGallery {...defaultProps} />,
89
+ 'only title': <MiniGallery {...onlyTitleProps} />,
90
+ };
@@ -0,0 +1,10 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { GalleryContent } from './GalleryContent';
3
+ import { GalleryInner } from './GalleryInner';
4
+ import { UniBlockProps } from './types';
5
+
6
+ export interface MiniGalleryProps extends GalleryContent, UniBlockProps {}
7
+
8
+ export const MiniGallery = JSX<MiniGalleryProps>((props) => (
9
+ <GalleryInner {...props} version="mini" />
10
+ ));
@@ -1,7 +1,7 @@
1
1
  import { context } from './setup-fixture';
2
2
 
3
3
  import { ProductBlock } from './ProductBlock';
4
- import { Picture } from './model/Picture';
4
+ import type { Picture } from './model/Picture';
5
5
 
6
6
  const image: Picture = {
7
7
  src: 'money-1.png',
@@ -1,10 +1,10 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { BaseTile } from './BaseTile';
3
3
  import type { Benefit } from './BenefitsBlockContent';
4
- import { Img } from './Img';
5
4
  import type { ProductBlockInnerContent } from './ProductBlockInnerContent';
6
5
  import type { UniBlockProps } from './types';
7
6
  import { Icon } from './ui-kit/Icon';
7
+ import { Img } from './ui-kit/Img';
8
8
  import { Title } from './ui-kit/Title';
9
9
 
10
10
  export interface ProductBlockInnerProps extends ProductBlockInnerContent, UniBlockProps {}
@@ -18,7 +18,7 @@ export const ProductBlockInner = JSX<ProductBlockInnerProps>(
18
18
  /* TODO Why <Title> is duplicated here? */
19
19
  <Title
20
20
  size={titleSize || 'XL'}
21
- className="font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]"
21
+ className="font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px] text-primary-text"
22
22
  >
23
23
  {title}
24
24
  </Title>
@@ -47,7 +47,7 @@ function renderBenefit(benefit: Benefit, i: number) {
47
47
  />
48
48
  )}
49
49
  <div className="flex gap-1 flex-col h-full">
50
- <h4 className="font-medium text-xl m-0">{benefit.label}</h4>
50
+ <h4 className="font-medium text-primary-text text-xl m-0">{benefit.label}</h4>
51
51
  {benefit.description && (
52
52
  <div className="font-normal text-sm text-secondary-text">{benefit.description}</div>
53
53
  )}
@@ -1,7 +1,7 @@
1
1
  import { context } from './setup-fixture';
2
2
 
3
3
  import { ProductTile } from './ProductTile';
4
- import { Picture } from './model/Picture';
4
+ import type { Picture } from './model/Picture';
5
5
 
6
6
  const cardWithMoney: Picture = {
7
7
  src: 'card-with-diamond.png',
@@ -1,6 +1,6 @@
1
1
  import { context } from './setup-fixture';
2
2
  import { TextBlock } from './TextBlock';
3
- import { Picture } from './model/Picture';
3
+ import type { Picture } from './model/Picture';
4
4
 
5
5
  const image: Picture = {
6
6
  src: 'bank-card.png',
package/src/TextBlock.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { Img } from './Img';
3
2
  import type { Picture } from './model/Picture';
4
3
  import type { TextBlockContent, TextBlockVersion } from './TextBlockContent';
5
4
  import type { UniBlockProps } from './types';
5
+ import { Img } from './ui-kit/Img';
6
6
 
7
7
  export interface TextBlockProps extends TextBlockContent, UniBlockProps {}
8
8
 
@@ -13,7 +13,7 @@ const textBlockStyleMaps: Record<
13
13
  primary: {
14
14
  background: 'bg-white',
15
15
  icon: 'bg-primary-main text-white',
16
- title: 'text-base',
16
+ title: 'text-primary-text',
17
17
  description: 'text-secondary-text',
18
18
  },
19
19
  secondary: {
@@ -25,7 +25,7 @@ const textBlockStyleMaps: Record<
25
25
  'secondary-light': {
26
26
  background: 'bg-primary-main/10',
27
27
  icon: 'bg-primary-main text-white',
28
- title: 'text-base',
28
+ title: 'text-primary-text',
29
29
  description: 'text-secondary-text',
30
30
  },
31
31
  };
@@ -40,7 +40,9 @@ export const TextBlock = JSX<TextBlockProps>(
40
40
  {iconVersion && iconVersion === 'small' ? renderIcon(textBlockStyleMap.icon) : null}
41
41
  {iconVersion && iconVersion === 'big' ? renderImage(image) : null}
42
42
  <div className="py-0.5">
43
- {title && <div className={`font-medium mb-1 ${textBlockStyleMap.title}`}>{title}</div>}
43
+ {title && (
44
+ <div className={`font-medium text-base mb-1 ${textBlockStyleMap.title}`}>{title}</div>
45
+ )}
44
46
  {description && (
45
47
  <div className={`text-sm ${textBlockStyleMap.description}`}>{description}</div>
46
48
  )}
@@ -1,7 +1,7 @@
1
1
  import { context } from './setup-fixture';
2
2
 
3
3
  import { Tile } from './Tile';
4
- import { Picture } from './model/Picture';
4
+ import type { Picture } from './model/Picture';
5
5
 
6
6
  const image: Picture = {
7
7
  src: 'money-1.png',
package/src/common.css CHANGED
@@ -7,6 +7,8 @@
7
7
  --color-primary-active: 36, 95, 52;
8
8
  --color-secondary-hover: 216, 242, 217;
9
9
  --color-secondary-active: 197, 226, 198;
10
+ --color-gradient-from: 141, 189, 76;
11
+ --color-gradient-to: 69, 172, 69;
10
12
  }
11
13
  /* Business clients | Light-Green */
12
14
  [data-theme='bc'] {
@@ -15,6 +17,8 @@
15
17
  --color-primary-active: 60, 94, 16;
16
18
  --color-secondary-hover: 232, 244, 217;
17
19
  --color-secondary-active: 216, 227, 202;
20
+ --color-gradient-from: 141, 189, 76; /* TODO: change color to theme bc */
21
+ --color-gradient-to: 69, 172, 69; /* TODO: change color to theme bc */
18
22
  }
19
23
  /* Ecosystem own | Yellow */
20
24
  [data-theme='eo'] {
@@ -23,6 +27,38 @@
23
27
  --color-primary-active: 126, 99, 12;
24
28
  --color-secondary-hover: 241, 236, 221;
25
29
  --color-secondary-active: 229, 222, 199;
30
+ --color-gradient-from: 141, 189, 76; /* TODO: change color to theme eo */
31
+ --color-gradient-to: 69, 172, 69; /* TODO: change color to theme eo */
32
+ }
33
+
34
+ [data-theme='eo2'] {
35
+ --color-primary-main: 255, 204, 0;
36
+ --color-primary-hover: 187, 151, 39;
37
+ --color-primary-active: 126, 99, 12;
38
+ --color-secondary-hover: 241, 236, 221;
39
+ --color-secondary-active: 229, 222, 199;
40
+ --color-gradient-from: 141, 189, 76; /* TODO: change color to theme eo */
41
+ --color-gradient-to: 69, 172, 69; /* TODO: change color to theme eo */
42
+ }
43
+
44
+ [data-theme='eo3'] {
45
+ --color-primary-main: 225, 186, 30;
46
+ --color-primary-hover: 187, 151, 39;
47
+ --color-primary-active: 126, 99, 12;
48
+ --color-secondary-hover: 241, 236, 221;
49
+ --color-secondary-active: 229, 222, 199;
50
+ --color-gradient-from: 141, 189, 76; /* TODO: change color to theme eo */
51
+ --color-gradient-to: 69, 172, 69; /* TODO: change color to theme eo */
52
+ }
53
+
54
+ [data-theme='eo4'] {
55
+ --color-primary-main: 233, 191, 23;
56
+ --color-primary-hover: 187, 151, 39;
57
+ --color-primary-active: 126, 99, 12;
58
+ --color-secondary-hover: 241, 236, 221;
59
+ --color-secondary-active: 229, 222, 199;
60
+ --color-gradient-from: 141, 189, 76; /* TODO: change color to theme eo */
61
+ --color-gradient-to: 69, 172, 69; /* TODO: change color to theme eo */
26
62
  }
27
63
 
28
64
  @tailwind components;
@@ -1,13 +1 @@
1
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#a)">
3
- <path
4
- d="M19.406 12.761c-.023-3.028 2.793-4.511 2.93-4.572-1.603-2.073-4.075-2.357-4.968-2.377-2.083-.204-4.098 1.117-5.174 1.117-1.076 0-2.725-1.097-4.488-1.056-2.266.04-4.395 1.198-5.563 3.007-2.404 3.698-.618 9.124 1.694 12.09 1.145 1.464 2.496 3.09 4.259 3.028 1.717-.06 2.358-.975 4.441-.975 2.06 0 2.656.975 4.465.935 1.854-.02 3.022-1.463 4.12-2.947 1.329-1.666 1.855-3.332 1.878-3.413 0 0-3.549-1.2-3.594-4.837Zm-3.389-8.92c.916-1.037 1.557-2.419 1.374-3.841-1.35.061-3.022.833-3.984 1.829-.847.894-1.625 2.337-1.42 3.698 1.512.102 3.069-.67 4.03-1.686Z"
5
- fill="#42AB44"
6
- />
7
- </g>
8
- <defs>
9
- <clipPath id="a">
10
- <rect width="24" height="24" rx="6" fill="#fff" />
11
- </clipPath>
12
- </defs>
13
- </svg>
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 24"><path d="M18.406 12.761c-.023-3.028 2.793-4.511 2.93-4.572-1.603-2.073-4.075-2.357-4.968-2.377-2.083-.204-4.098 1.117-5.174 1.117-1.076 0-2.725-1.097-4.488-1.056-2.266.04-4.395 1.198-5.563 3.007-2.404 3.698-.618 9.124 1.694 12.09 1.145 1.464 2.496 3.09 4.259 3.028 1.717-.06 2.358-.975 4.441-.975 2.06 0 2.656.975 4.465.935 1.854-.02 3.022-1.463 4.12-2.947 1.329-1.666 1.855-3.332 1.878-3.413 0 0-3.549-1.2-3.594-4.837Zm-3.389-8.92c.916-1.037 1.557-2.419 1.374-3.841-1.35.061-3.022.833-3.984 1.829-.847.894-1.625 2.337-1.42 3.698 1.512.102 3.069-.67 4.03-1.686Z" fill="#42AB44"/></svg>