@redneckz/wildless-cms-uni-blocks 0.2.47 → 0.2.50

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 (79) hide show
  1. package/README.md +3 -0
  2. package/dist/Blocks.d.ts +13 -0
  3. package/dist/Blocks.js +2 -0
  4. package/dist/Blocks.js.map +1 -1
  5. package/dist/Footer/Footer.d.ts +1 -2
  6. package/dist/Footer/Footer.js.map +1 -1
  7. package/dist/Footer/Sitemap.js +6 -4
  8. package/dist/Footer/Sitemap.js.map +1 -1
  9. package/dist/Footer/index.d.ts +1 -1
  10. package/dist/Header/Header.js +1 -1
  11. package/dist/Header/Header.js.map +1 -1
  12. package/dist/Header/HeaderSecondaryMenu.js +1 -1
  13. package/dist/Header/HeaderSecondaryMenu.js.map +1 -1
  14. package/dist/ProductBlockInner.js +2 -1
  15. package/dist/ProductBlockInner.js.map +1 -1
  16. package/dist/ProductGallery.js +2 -2
  17. package/dist/ProductGallery.js.map +1 -1
  18. package/dist/ProductTile.d.ts +17 -0
  19. package/dist/ProductTile.js +27 -0
  20. package/dist/ProductTile.js.map +1 -0
  21. package/dist/StepsBlock.js +7 -3
  22. package/dist/StepsBlock.js.map +1 -1
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +3 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/types.d.ts +2 -9
  27. package/dist/ui-kit/TopItem.js +1 -1
  28. package/dist/ui-kit/TopItem.js.map +1 -1
  29. package/dist/utils/joinList.d.ts +1 -0
  30. package/dist/utils/joinList.js +7 -0
  31. package/dist/utils/joinList.js.map +1 -0
  32. package/lib/Blocks.d.ts +13 -0
  33. package/lib/Blocks.js +2 -0
  34. package/lib/Blocks.js.map +1 -1
  35. package/lib/Footer/Footer.d.ts +1 -2
  36. package/lib/Footer/Footer.js.map +1 -1
  37. package/lib/Footer/Sitemap.js +6 -4
  38. package/lib/Footer/Sitemap.js.map +1 -1
  39. package/lib/Footer/index.d.ts +1 -1
  40. package/lib/Header/Header.js +1 -1
  41. package/lib/Header/Header.js.map +1 -1
  42. package/lib/Header/HeaderSecondaryMenu.js +1 -1
  43. package/lib/Header/HeaderSecondaryMenu.js.map +1 -1
  44. package/lib/ProductBlockInner.js +2 -1
  45. package/lib/ProductBlockInner.js.map +1 -1
  46. package/lib/ProductGallery.js +2 -2
  47. package/lib/ProductGallery.js.map +1 -1
  48. package/lib/ProductTile.d.ts +17 -0
  49. package/lib/ProductTile.js +25 -0
  50. package/lib/ProductTile.js.map +1 -0
  51. package/lib/StepsBlock.js +7 -3
  52. package/lib/StepsBlock.js.map +1 -1
  53. package/lib/common.css +1 -1
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.js +1 -0
  56. package/lib/index.js.map +1 -1
  57. package/lib/types.d.ts +2 -9
  58. package/lib/ui-kit/TopItem.js +1 -1
  59. package/lib/ui-kit/TopItem.js.map +1 -1
  60. package/lib/utils/joinList.d.ts +1 -0
  61. package/lib/utils/joinList.js +4 -0
  62. package/lib/utils/joinList.js.map +1 -0
  63. package/package.json +1 -1
  64. package/src/Blocks.ts +25 -9
  65. package/src/ContentPage.page.json +140 -0
  66. package/src/Footer/Footer.tsx +2 -1
  67. package/src/Footer/Sitemap.tsx +7 -5
  68. package/src/Footer/index.ts +1 -1
  69. package/src/Header/Header.tsx +1 -1
  70. package/src/Header/HeaderSecondaryMenu.tsx +1 -1
  71. package/src/ProductBlockInner.tsx +4 -3
  72. package/src/ProductGallery.tsx +3 -5
  73. package/src/ProductTile.fixture.tsx +147 -0
  74. package/src/ProductTile.tsx +95 -0
  75. package/src/StepsBlock.tsx +20 -6
  76. package/src/index.ts +1 -0
  77. package/src/types.ts +2 -17
  78. package/src/ui-kit/TopItem.tsx +1 -1
  79. package/src/utils/joinList.ts +7 -0
@@ -29,16 +29,14 @@ export const ProductGallery = JSX<ProductGalleryProps>(
29
29
  return (
30
30
  <section className={`font-sans bg-white overflow-hidden w-100 ${className || ''}`}>
31
31
  <div
32
- className={`flex transition duration-1000`}
32
+ className={`flex duration-1000`}
33
33
  style={{ transform: `translateX(-${activeSlideIndex}00%)` }}
34
34
  role="list"
35
35
  >
36
36
  {galleryBlocks.map((_, i) => renderProductBlock(_, i, context))}
37
37
  </div>
38
38
 
39
- <div
40
- className={`border-0 border-t border-solid border-main-divider grid grid-cols-${galleryNav.length}`}
41
- >
39
+ <div className={`border-t border-solid border-main-divider flex`}>
42
40
  {galleryNav.map((slide, i) =>
43
41
  renderNavButton({
44
42
  slide,
@@ -73,7 +71,7 @@ function renderNavButton({ slide, i, activeSlideIndex, onClick, duration }) {
73
71
  type="button"
74
72
  key={String(i)}
75
73
  onClick={onClick}
76
- className={`group relative overflow-hidden border-0 bg-inherit cursor-pointer text-left px-0 py-4`}
74
+ className={`group relative overflow-hidden border-0 bg-inherit cursor-pointer text-left px-0 py-4 grow basis-0`}
77
75
  >
78
76
  <div className="border-0 border-r border-solid border-main-divider px-6">
79
77
  <div className={`text-sm font-medium group-hover:text-primary-text ${btnTitleClassName}`}>
@@ -0,0 +1,147 @@
1
+ import { context } from './setup-fixture';
2
+
3
+ import { ProductTile } from './ProductTile';
4
+ import { Picture } from './types';
5
+
6
+ const cardWithMoney: Picture = {
7
+ src: 'card-with-diamond.png',
8
+ alt: 'Кредиты в РСХБ',
9
+ format: 'webp',
10
+ };
11
+
12
+ const letterWithMoney: Picture = {
13
+ src: 'letter-with-money.png',
14
+ alt: 'Пенсионный кредит в РСХБ',
15
+ format: 'webp',
16
+ };
17
+
18
+ const building: Picture = {
19
+ src: 'building.png',
20
+ alt: 'Кредит под залог недвижимости в РСХБ',
21
+ format: 'webp',
22
+ };
23
+
24
+ export default {
25
+ credit: (
26
+ <div className="grid grid-cols-12">
27
+ <ProductTile
28
+ context={context}
29
+ className="col-span-6"
30
+ title="Акция! “Кредит На все, что хочется!”"
31
+ description="Потребительский кредит на любые цели, без залога и поручительства"
32
+ benefits={[
33
+ {
34
+ label: 'Кредитный лимит',
35
+ description: 'до 5 млн Р',
36
+ },
37
+ {
38
+ label: 'Процентная ставка',
39
+ description: 'от 12,5%',
40
+ },
41
+ {
42
+ label: 'Срок кредитования',
43
+ description: 'до 5 лет',
44
+ },
45
+ ]}
46
+ button={{
47
+ text: 'Подробнее',
48
+ href: '/credit-cards',
49
+ version: 'secondary',
50
+ }}
51
+ image={cardWithMoney}
52
+ />
53
+ </div>
54
+ ),
55
+ pension: (
56
+ <div className="grid grid-cols-12">
57
+ <ProductTile
58
+ context={context}
59
+ className="col-span-6"
60
+ title="Акция! “Пенсионный кредит”"
61
+ description={'Потребительский кредит на любые цели, без залога и поручительства'}
62
+ benefits={[
63
+ {
64
+ label: 'Кредитный лимит',
65
+ description: 'до 3 млн Р',
66
+ },
67
+ {
68
+ label: 'Процентная ставка',
69
+ description: 'от 12,5%',
70
+ },
71
+ {
72
+ label: 'Срок кредитования',
73
+ description: 'до 3 лет',
74
+ },
75
+ ]}
76
+ button={{
77
+ href: 'https://rshb.ru',
78
+ text: 'Подробнее',
79
+ target: '_blank',
80
+ version: 'secondary',
81
+ }}
82
+ image={letterWithMoney}
83
+ />
84
+ </div>
85
+ ),
86
+ 'credit-card': (
87
+ <div className="grid grid-cols-12">
88
+ <ProductTile
89
+ context={context}
90
+ className="col-span-8"
91
+ title="Кредит под залог недвижимости"
92
+ description={'Без переоформления залогой недвижимости на банк'}
93
+ benefits={[
94
+ {
95
+ label: 'Кредитный лимит',
96
+ description: 'до 10 млн Р',
97
+ },
98
+ {
99
+ label: 'Процентная ставка',
100
+ description: 'от 21,5%',
101
+ },
102
+ {
103
+ label: 'Срок кредитования',
104
+ description: 'до 10 лет',
105
+ },
106
+ ]}
107
+ button={{
108
+ href: 'https://rshb.ru',
109
+ text: 'Подробнее',
110
+ target: '_blank',
111
+ version: 'secondary',
112
+ }}
113
+ image={building}
114
+ />
115
+ </div>
116
+ ),
117
+ 'pension-credit': (
118
+ <div className="grid grid-cols-12">
119
+ <ProductTile
120
+ context={context}
121
+ className="col-span-4"
122
+ title="Кредит пенсионный"
123
+ description={'Для людей в возрасте до 75 лет'}
124
+ benefits={[
125
+ {
126
+ label: 'Кредитный лимит',
127
+ description: 'до 3 млн Р',
128
+ },
129
+ {
130
+ label: 'Процентная ставка',
131
+ description: 'от 16,8%',
132
+ },
133
+ {
134
+ label: 'Срок кредитования',
135
+ description: 'до 5 лет',
136
+ },
137
+ ]}
138
+ button={{
139
+ href: 'https://rshb.ru',
140
+ text: 'Подробнее',
141
+ target: '_blank',
142
+ version: 'secondary',
143
+ }}
144
+ />
145
+ </div>
146
+ ),
147
+ };
@@ -0,0 +1,95 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { ContentPageContext } from './ContentPageContext';
3
+ import { Img } from './Img';
4
+ import { BlockVersion, Picture } from './types';
5
+ import type { ButtonProps } from './ui-kit/Button';
6
+ import { Button } from './ui-kit/Button';
7
+ import { useLink } from './useLink';
8
+ import type { Benefit } from './types';
9
+
10
+ export interface ProductTileContent {
11
+ title?: string;
12
+ description?: string;
13
+ benefits?: Benefit[];
14
+ image?: Picture;
15
+ button?: ButtonProps;
16
+ version?: BlockVersion;
17
+ }
18
+
19
+ export interface ProductTileProps extends ProductTileContent {
20
+ className?: string;
21
+ context: ContentPageContext;
22
+ }
23
+
24
+ const productTileStyleMap: Record<BlockVersion, string> = {
25
+ primary: 'bg-white text-primary-text',
26
+ secondary: 'bg-primary-main text-white',
27
+ };
28
+
29
+ export const ProductTile = JSX<ProductTileProps>(
30
+ ({ className, context, title, description, button, image, benefits, version = 'primary' }) => {
31
+ const router = context.useRouter();
32
+ const { handlerDecorator } = context;
33
+ return (
34
+ <section className={`font-sans p-9 ${className || ''} ${productTileStyleMap[version]}`}>
35
+ <div className="flex flex-col w-full">
36
+ {title && (
37
+ <h3 className="font-medium text-title-sm m-0 whitespace-pre-wrap max-w-[600px]">
38
+ {title}
39
+ </h3>
40
+ )}
41
+ {description && (
42
+ <div className="font-normal text-base max-w-[600px] mt-4">{description}</div>
43
+ )}
44
+ <div className="flex mt-5">
45
+ <div className="grow flex flex-col">
46
+ <div className="flex">
47
+ {benefits?.length ? (
48
+ <div className="mr-8">{benefits.map(renderBenefitDescription)}</div>
49
+ ) : null}
50
+ {benefits?.length ? (
51
+ <div className="pt-1">
52
+ {benefits.map((_, i) => renderBenefitLabel(_, i, version))}
53
+ </div>
54
+ ) : null}
55
+ </div>
56
+ {button?.text && (
57
+ <div className="mt-auto">
58
+ <Button
59
+ className="mt-8"
60
+ {...useLink({ router, handlerDecorator }, button)}
61
+ version="secondary"
62
+ />
63
+ </div>
64
+ )}
65
+ </div>
66
+ {image && (
67
+ <div className="mt-auto flex-none h-[220px] w-[220px]">
68
+ <Img image={image} />
69
+ </div>
70
+ )}
71
+ </div>
72
+ </div>
73
+ </section>
74
+ );
75
+ },
76
+ );
77
+
78
+ function renderBenefitLabel(benefit: Benefit, i: number, version = 'primary') {
79
+ const labelStyleMap: Record<BlockVersion, string> = {
80
+ primary: 'text-secondary-text',
81
+ secondary: 'text-white',
82
+ };
83
+ return (
84
+ <div key={String(i)} className={`text-sm mb-4 ${labelStyleMap[version]}`}>
85
+ {benefit.label}
86
+ </div>
87
+ );
88
+ }
89
+ function renderBenefitDescription(benefit: Benefit, i: number) {
90
+ return (
91
+ <div key={String(i)} className="text-xl font-medium mb-2.5">
92
+ {benefit.description}
93
+ </div>
94
+ );
95
+ }
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { NewDocIcon, PassSendIcon, ActualBalanceIcon } from './Icons/index';
3
3
  import type { UniBlockProps } from './types';
4
+ import { joinList } from './utils/joinList';
4
5
 
5
6
  const ICONS = { NewDocIcon, PassSendIcon, ActualBalanceIcon };
6
7
  export interface Step {
@@ -24,22 +25,35 @@ export const StepsBlock = JSX<StepsBlockProps>(({ className, title, steps }) =>
24
25
  }`}
25
26
  >
26
27
  <h2 className="font-medium text-title m-0 max-w-[47rem] text-center">{title}</h2>
27
- {steps?.length ? <div className="flex mt-9">{steps.map(renderStep)}</div> : null}
28
+ {steps?.length ? (
29
+ <div>
30
+ <div className="flex mt-9 items-center px-[88px]">
31
+ {joinList(<div className="h-0.5 w-full bg-secondary-light"></div>)(
32
+ steps.map((step, i) => renderStepIcon(step, i)),
33
+ )}
34
+ </div>
35
+ <div className="flex mt-9 justify-between gap-x-24">{steps.map(renderStepTitle)}</div>
36
+ </div>
37
+ ) : null}
28
38
  </section>
29
39
  );
30
40
  });
31
41
 
32
- const renderStep = (step: Step, i: number) => {
42
+ const renderStepIcon = (step: Step, i: number) => {
33
43
  return (
34
- <div
35
- key={String(i)}
36
- className="flex flex-col items-center text-center px-12 relative after:content-[''] last:after:content-none after:bg-secondary-light after:absolute after:top-[50px] after:h-0.5 after:w-full after:right-[-50%]"
37
- >
44
+ <div key={String(i)} className="flex flex-col items-center text-center relative">
38
45
  <div className="h-[100px] w-[100px] min-w-[100px] min-h-[100px] bg-secondary-light rounded-full p-[26px] box-border z-10">
39
46
  {(step.icon && ICONS[step.icon]?.({ width: 48, height: 48 })) || (
40
47
  <span className="font-medium text-title-sm text-secondary-text">{i + 1}</span>
41
48
  )}
42
49
  </div>
50
+ </div>
51
+ );
52
+ };
53
+
54
+ const renderStepTitle = (step: Step, i: number) => {
55
+ return (
56
+ <div key={String(i)} className="flex flex-col items-center text-center relative w-[276px]">
43
57
  <div className="max-w-min">
44
58
  <h5 className="font-medium text-xl m-0 mt-4 whitespace-nowrap px-3">{step.label}</h5>
45
59
  {step.description && (
package/src/index.ts CHANGED
@@ -17,3 +17,4 @@ export { Blocks } from './Blocks';
17
17
  export { LikeAPI } from './api/LikeAPI';
18
18
 
19
19
  export * as url from './utils/url';
20
+ export { joinList } from './utils/joinList';
package/src/types.ts CHANGED
@@ -9,27 +9,12 @@ import type {
9
9
  TiffOptions,
10
10
  WebpOptions,
11
11
  } from 'sharp';
12
- import type { BenefitsBlockContent } from './BenefitsBlock';
12
+ import type { BlockContent } from './Blocks';
13
13
  import type { ContentPageContext } from './ContentPageContext';
14
- import type { HeaderContent } from './Header/index';
15
- import type { PlaceholderContent } from './Placeholder';
16
- import type { ProductBlockInnerContent } from './ProductBlockInner';
17
- import type { ProductGalleryContent } from './ProductGallery';
18
- import type { StepsBlockContent } from './StepsBlock';
19
- import type { TileContent } from './Tile';
20
-
21
- export type BlockVersion = 'primary' | 'secondary';
22
14
 
23
15
  export type ColorPalette = 'pc' | 'bc' | 'eo';
24
16
 
25
- export type BlockContent =
26
- | HeaderContent
27
- | PlaceholderContent
28
- | ProductBlockInnerContent
29
- | TileContent
30
- | StepsBlockContent
31
- | BenefitsBlockContent
32
- | ProductGalleryContent;
17
+ export type BlockVersion = 'primary' | 'secondary';
33
18
 
34
19
  export interface BlockDef {
35
20
  type: string;
@@ -14,7 +14,7 @@ export interface TopItemProps extends TopItemContent {
14
14
 
15
15
  export const TopItem = JSX<TopItemProps>(
16
16
  ({ className, text, href, target, active, flat, onClick, children, ariaLabel }) => {
17
- const linkStyle = active ? 'border-primary-main rounded-3xl' : 'border-transparent';
17
+ const linkStyle = active ? 'border-primary-main rounded-md' : 'border-transparent';
18
18
  const textStyle = active
19
19
  ? 'text-primary-main'
20
20
  : `${flat ? 'text-primary-text' : 'text-secondary-text'} hover:text-primary-main`;
@@ -0,0 +1,7 @@
1
+ export function joinList<E>(sep: E): (list: E[]) => E[] {
2
+ return (list) =>
3
+ list.reduce(
4
+ (acc, el, i) => (acc.length ? acc.concat({ ...sep, key: i }, el) : [el]),
5
+ [] as E[],
6
+ );
7
+ }