@redneckz/wildless-cms-uni-blocks 0.2.46 → 0.2.49

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 (252) hide show
  1. package/README.md +3 -0
  2. package/dist/BenefitsBlock.d.ts +2 -2
  3. package/dist/Blocks.d.ts +15 -0
  4. package/dist/Blocks.js +13 -7
  5. package/dist/Blocks.js.map +1 -1
  6. package/dist/ContentPage.d.ts +2 -2
  7. package/dist/ContentPage.js +3 -3
  8. package/dist/ContentPage.js.map +1 -1
  9. package/dist/ContentPageContext.d.ts +6 -3
  10. package/dist/ExchangeRateTile.d.ts +7 -0
  11. package/dist/ExchangeRateTile.js +32 -0
  12. package/dist/ExchangeRateTile.js.map +1 -0
  13. package/dist/Footer/Contacts.d.ts +2 -2
  14. package/dist/Footer/Footer.d.ts +3 -4
  15. package/dist/Footer/Footer.js.map +1 -1
  16. package/dist/Footer/FooterLink.d.ts +2 -2
  17. package/dist/Footer/Sitemap.d.ts +2 -2
  18. package/dist/Footer/Sitemap.js +8 -5
  19. package/dist/Footer/Sitemap.js.map +1 -1
  20. package/dist/Footer/SocialMedia.d.ts +2 -2
  21. package/dist/Footer/SocialMedia.js +5 -5
  22. package/dist/Footer/SocialMedia.js.map +1 -1
  23. package/dist/Footer/index.d.ts +1 -1
  24. package/dist/Header/Header.d.ts +2 -2
  25. package/dist/Header/Header.js +3 -2
  26. package/dist/Header/Header.js.map +1 -1
  27. package/dist/Icons/DollarIcon.d.ts +1 -0
  28. package/dist/Icons/DollarIcon.js +6 -0
  29. package/dist/Icons/DollarIcon.js.map +1 -0
  30. package/dist/Icons/EuroIcon.d.ts +1 -0
  31. package/dist/Icons/EuroIcon.js +6 -0
  32. package/dist/Icons/EuroIcon.js.map +1 -0
  33. package/dist/Icons/index.d.ts +17 -16
  34. package/dist/Icons/index.js +26 -22
  35. package/dist/Icons/index.js.map +1 -1
  36. package/dist/Img.js +1 -1
  37. package/dist/Img.js.map +1 -1
  38. package/dist/LikeControl.d.ts +2 -2
  39. package/dist/LikeControl.js.map +1 -1
  40. package/dist/MobileAppTile.d.ts +8 -0
  41. package/dist/MobileAppTile.js +9 -0
  42. package/dist/MobileAppTile.js.map +1 -0
  43. package/dist/Placeholder.d.ts +3 -1
  44. package/dist/Placeholder.js +9 -2
  45. package/dist/Placeholder.js.map +1 -1
  46. package/dist/ProductBlock.d.ts +2 -2
  47. package/dist/ProductBlockInner.d.ts +2 -2
  48. package/dist/ProductBlockInner.js +2 -1
  49. package/dist/ProductBlockInner.js.map +1 -1
  50. package/dist/ProductGallery.d.ts +2 -2
  51. package/dist/ProductGallery.js +3 -3
  52. package/dist/ProductGallery.js.map +1 -1
  53. package/dist/ProductTile.d.ts +17 -0
  54. package/dist/ProductTile.js +27 -0
  55. package/dist/ProductTile.js.map +1 -0
  56. package/dist/ProjectSettings.d.ts +18 -0
  57. package/dist/ProjectSettings.js +30 -0
  58. package/dist/ProjectSettings.js.map +1 -0
  59. package/dist/StepsBlock.d.ts +2 -2
  60. package/dist/StepsBlock.js +7 -3
  61. package/dist/StepsBlock.js.map +1 -1
  62. package/dist/Tile.d.ts +2 -2
  63. package/dist/Tile.js +15 -7
  64. package/dist/Tile.js.map +1 -1
  65. package/dist/index.d.ts +6 -3
  66. package/dist/index.js +9 -5
  67. package/dist/index.js.map +1 -1
  68. package/dist/types.d.ts +3 -10
  69. package/dist/ui-kit/SearchBar.d.ts +2 -2
  70. package/dist/ui-kit/SearchBar.js.map +1 -1
  71. package/dist/useSitemap.d.ts +3 -0
  72. package/dist/useSitemap.js +16 -0
  73. package/dist/useSitemap.js.map +1 -0
  74. package/dist/utils/joinList.d.ts +1 -0
  75. package/dist/utils/joinList.js +7 -0
  76. package/dist/utils/joinList.js.map +1 -0
  77. package/lib/BenefitsBlock.d.ts +2 -2
  78. package/lib/Blocks.d.ts +15 -0
  79. package/lib/Blocks.js +10 -4
  80. package/lib/Blocks.js.map +1 -1
  81. package/lib/ContentPage.d.ts +2 -2
  82. package/lib/ContentPage.js +3 -3
  83. package/lib/ContentPage.js.map +1 -1
  84. package/lib/ContentPageContext.d.ts +6 -3
  85. package/lib/ExchangeRateTile.d.ts +7 -0
  86. package/lib/ExchangeRateTile.js +30 -0
  87. package/lib/ExchangeRateTile.js.map +1 -0
  88. package/lib/Footer/Contacts.d.ts +2 -2
  89. package/lib/Footer/Footer.d.ts +3 -4
  90. package/lib/Footer/Footer.js.map +1 -1
  91. package/lib/Footer/FooterLink.d.ts +2 -2
  92. package/lib/Footer/Sitemap.d.ts +2 -2
  93. package/lib/Footer/Sitemap.js +8 -5
  94. package/lib/Footer/Sitemap.js.map +1 -1
  95. package/lib/Footer/SocialMedia.d.ts +2 -2
  96. package/lib/Footer/SocialMedia.js +5 -5
  97. package/lib/Footer/SocialMedia.js.map +1 -1
  98. package/lib/Footer/index.d.ts +1 -1
  99. package/lib/Header/Header.d.ts +2 -2
  100. package/lib/Header/Header.js +3 -2
  101. package/lib/Header/Header.js.map +1 -1
  102. package/lib/Icons/DollarIcon.d.ts +1 -0
  103. package/lib/Icons/DollarIcon.js +3 -0
  104. package/lib/Icons/DollarIcon.js.map +1 -0
  105. package/lib/Icons/EuroIcon.d.ts +1 -0
  106. package/lib/Icons/EuroIcon.js +3 -0
  107. package/lib/Icons/EuroIcon.js.map +1 -0
  108. package/lib/Icons/index.d.ts +17 -16
  109. package/lib/Icons/index.js +17 -16
  110. package/lib/Icons/index.js.map +1 -1
  111. package/lib/Img.js +1 -1
  112. package/lib/Img.js.map +1 -1
  113. package/lib/LikeControl.d.ts +2 -2
  114. package/lib/LikeControl.js.map +1 -1
  115. package/lib/MobileAppTile.d.ts +8 -0
  116. package/lib/MobileAppTile.js +7 -0
  117. package/lib/MobileAppTile.js.map +1 -0
  118. package/lib/Placeholder.d.ts +3 -1
  119. package/lib/Placeholder.js +9 -2
  120. package/lib/Placeholder.js.map +1 -1
  121. package/lib/ProductBlock.d.ts +2 -2
  122. package/lib/ProductBlockInner.d.ts +2 -2
  123. package/lib/ProductBlockInner.js +2 -1
  124. package/lib/ProductBlockInner.js.map +1 -1
  125. package/lib/ProductGallery.d.ts +2 -2
  126. package/lib/ProductGallery.js +3 -3
  127. package/lib/ProductGallery.js.map +1 -1
  128. package/lib/ProductTile.d.ts +17 -0
  129. package/lib/ProductTile.js +25 -0
  130. package/lib/ProductTile.js.map +1 -0
  131. package/lib/ProjectSettings.d.ts +18 -0
  132. package/lib/ProjectSettings.js +28 -0
  133. package/lib/ProjectSettings.js.map +1 -0
  134. package/lib/StepsBlock.d.ts +2 -2
  135. package/lib/StepsBlock.js +7 -3
  136. package/lib/StepsBlock.js.map +1 -1
  137. package/lib/Tile.d.ts +2 -2
  138. package/lib/Tile.js +15 -7
  139. package/lib/Tile.js.map +1 -1
  140. package/lib/common.css +1 -1
  141. package/lib/index.d.ts +6 -3
  142. package/lib/index.js +4 -2
  143. package/lib/index.js.map +1 -1
  144. package/lib/types.d.ts +3 -10
  145. package/lib/ui-kit/SearchBar.d.ts +2 -2
  146. package/lib/ui-kit/SearchBar.js.map +1 -1
  147. package/lib/useSitemap.d.ts +3 -0
  148. package/lib/useSitemap.js +13 -0
  149. package/lib/useSitemap.js.map +1 -0
  150. package/lib/utils/joinList.d.ts +1 -0
  151. package/lib/utils/joinList.js +4 -0
  152. package/lib/utils/joinList.js.map +1 -0
  153. package/package.json +3 -2
  154. package/src/BenefitsBlock.fixture.tsx +34 -0
  155. package/src/BenefitsBlock.tsx +45 -0
  156. package/src/Blocks.ts +39 -0
  157. package/src/ContentPage.fixture.tsx +38 -0
  158. package/src/ContentPage.page.json +680 -0
  159. package/src/ContentPage.tsx +83 -0
  160. package/src/ContentPageContext.tsx +34 -0
  161. package/src/ContentPageHead.tsx +26 -0
  162. package/src/ExchangeRateTile.fixture.tsx +11 -0
  163. package/src/ExchangeRateTile.tsx +80 -0
  164. package/src/Footer/Contacts.tsx +71 -0
  165. package/src/Footer/Footer.fixture.tsx +265 -0
  166. package/src/Footer/Footer.tsx +47 -0
  167. package/src/Footer/FooterLink.ts +6 -0
  168. package/src/Footer/HorizontalNavigation.tsx +46 -0
  169. package/src/Footer/Sitemap.tsx +57 -0
  170. package/src/Footer/SocialMedia.tsx +46 -0
  171. package/src/Footer/TextInformation.tsx +50 -0
  172. package/src/Footer/index.ts +2 -0
  173. package/src/Header/Header.fixture.tsx +21 -0
  174. package/src/Header/Header.tsx +55 -0
  175. package/src/Header/HeaderContent.ts +6 -0
  176. package/src/Header/HeaderSecondaryMenu.tsx +42 -0
  177. package/src/Header/HeaderSecondaryMenuButton.tsx +21 -0
  178. package/src/Header/index.ts +3 -0
  179. package/src/Header/isSubItemActive.ts +9 -0
  180. package/src/Header/isTopItemActive.ts +13 -0
  181. package/src/Icons/ActualBalanceIcon.tsx +202 -0
  182. package/src/Icons/CalendarIcon.tsx +19 -0
  183. package/src/Icons/ClockIcon.tsx +212 -0
  184. package/src/Icons/ComfortableCompIcon.tsx +379 -0
  185. package/src/Icons/DollarIcon.tsx +12 -0
  186. package/src/Icons/EmptyWalletIcon.tsx +25 -0
  187. package/src/Icons/EuroIcon.tsx +12 -0
  188. package/src/Icons/GridIcon.tsx +9 -0
  189. package/src/Icons/LoupeIcon.tsx +11 -0
  190. package/src/Icons/NewDocIcon.tsx +262 -0
  191. package/src/Icons/OkIcon.tsx +8 -0
  192. package/src/Icons/PassSendIcon.tsx +250 -0
  193. package/src/Icons/PercentageSquareIcon.tsx +18 -0
  194. package/src/Icons/ProfileIcon.tsx +18 -0
  195. package/src/Icons/SignDocsIcon.tsx +295 -0
  196. package/src/Icons/TelegramIcon.tsx +8 -0
  197. package/src/Icons/VKIcon.tsx +10 -0
  198. package/src/Icons/index.ts +17 -0
  199. package/src/Img.tsx +22 -0
  200. package/src/LikeControl.fixture.tsx +5 -0
  201. package/src/LikeControl.tsx +23 -0
  202. package/src/MobileAppTile.fixture.tsx +15 -0
  203. package/src/MobileAppTile.tsx +34 -0
  204. package/src/Placeholder.fixture.tsx +5 -0
  205. package/src/Placeholder.tsx +33 -0
  206. package/src/ProductBlock.fixture.tsx +95 -0
  207. package/src/ProductBlock.tsx +15 -0
  208. package/src/ProductBlockInner.tsx +111 -0
  209. package/src/ProductGallery.fixture.tsx +138 -0
  210. package/src/ProductGallery.tsx +88 -0
  211. package/src/ProductTile.fixture.tsx +147 -0
  212. package/src/ProductTile.tsx +95 -0
  213. package/src/ProjectSettings.ts +38 -0
  214. package/src/StepsBlock.fixture.tsx +23 -0
  215. package/src/StepsBlock.tsx +65 -0
  216. package/src/Tile.fixture.tsx +124 -0
  217. package/src/Tile.tsx +89 -0
  218. package/src/api/LikeAPI.ts +141 -0
  219. package/src/common.css +39 -0
  220. package/src/content-page-repository/ContentPageRepository.ts +38 -0
  221. package/src/content-page-repository/TransformationOptions.ts +4 -0
  222. package/src/content-page-repository/index.ts +1 -0
  223. package/src/content-page-repository/mapJSON.spec.ts +28 -0
  224. package/src/content-page-repository/mapJSON.ts +23 -0
  225. package/src/content-page-repository/transformContentPage.ts +26 -0
  226. package/src/content-page-repository/transformMarkdown.ts +10 -0
  227. package/src/content-page-repository/transformPicture.ts +61 -0
  228. package/src/cosmos.decorator.tsx +19 -0
  229. package/src/index.ts +20 -0
  230. package/src/mergeTopItems.spec.ts +20 -0
  231. package/src/mergeTopItems.ts +13 -0
  232. package/src/setup-fixture.ts +49 -0
  233. package/src/types.ts +94 -0
  234. package/src/ui-kit/BlockItem.fixture.tsx +5 -0
  235. package/src/ui-kit/BlockItem.tsx +36 -0
  236. package/src/ui-kit/Breadcrumb.tsx +26 -0
  237. package/src/ui-kit/Button.fixture.tsx +113 -0
  238. package/src/ui-kit/Button.tsx +66 -0
  239. package/src/ui-kit/HeaderItem.fixture.tsx +8 -0
  240. package/src/ui-kit/HeaderItem.tsx +25 -0
  241. package/src/ui-kit/LikeButton.fixture.tsx +6 -0
  242. package/src/ui-kit/LikeButton.tsx +41 -0
  243. package/src/ui-kit/Logo.fixture.tsx +5 -0
  244. package/src/ui-kit/Logo.tsx +35 -0
  245. package/src/ui-kit/SVG.tsx +32 -0
  246. package/src/ui-kit/SearchBar.tsx +33 -0
  247. package/src/ui-kit/TopItem.fixture.tsx +8 -0
  248. package/src/ui-kit/TopItem.tsx +37 -0
  249. package/src/useLink.ts +28 -0
  250. package/src/useSitemap.ts +17 -0
  251. package/src/utils/joinList.ts +7 -0
  252. package/src/utils/url.ts +22 -0
package/src/index.ts ADDED
@@ -0,0 +1,20 @@
1
+ export type { ProjectSettings } from './ProjectSettings';
2
+ export { projectSettings } from './ProjectSettings';
3
+
4
+ export type { BlockDef, ContentPageMeta, ContentPageDef, Img, ImgSource, Picture } from './types';
5
+ export type {
6
+ ContentPageContext,
7
+ Router,
8
+ LikeService,
9
+ Search,
10
+ HandlerDecorator,
11
+ } from './ContentPageContext';
12
+
13
+ export { ContentPageHead } from './ContentPageHead';
14
+ export { ContentPage } from './ContentPage';
15
+
16
+ export { Blocks } from './Blocks';
17
+ export { LikeAPI } from './api/LikeAPI';
18
+
19
+ export * as url from './utils/url';
20
+ export { joinList } from './utils/joinList';
@@ -0,0 +1,20 @@
1
+ import { mergeTopItems } from './mergeTopItems';
2
+
3
+ describe('mergeTopItems', () => {
4
+ it('should return original items if no extra items provided', () => {
5
+ const items = [{ href: '/' }];
6
+ expect(mergeTopItems(items)).toEqual(items);
7
+ });
8
+
9
+ it('should append extra items to original ones', () => {
10
+ const items = [{ href: '/' }];
11
+ const extraItems = [{ href: '/foo' }, { href: '/bar' }];
12
+ expect(mergeTopItems(items, extraItems)).toEqual(items.concat(extraItems));
13
+ });
14
+
15
+ it('should replace original items with duplicating extra items (by href)', () => {
16
+ const items = [{ href: '/foo' }];
17
+ const extraItems = [{ href: '/foo', text: 'foo' }, { href: '/bar' }];
18
+ expect(mergeTopItems(items, extraItems)).toEqual(extraItems);
19
+ });
20
+ });
@@ -0,0 +1,13 @@
1
+ import type { TopMenuItem } from './types';
2
+
3
+ const cmp = (a?: TopMenuItem) => (b?: TopMenuItem) => a?.href === b?.href;
4
+
5
+ const substitute = (items?: TopMenuItem[], substitution?: TopMenuItem[]) =>
6
+ (items || []).map((_) => substitution?.find(cmp(_)) || _);
7
+
8
+ const subtract = (minuend?: TopMenuItem[], subtrahend?: TopMenuItem[]) =>
9
+ (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
10
+
11
+ export function mergeTopItems(left?: TopMenuItem[], right?: TopMenuItem[]): TopMenuItem[] {
12
+ return substitute(left, right).concat(subtract(right, left));
13
+ }
@@ -0,0 +1,49 @@
1
+ import { setup } from '@redneckz/uni-jsx';
2
+ import runtime from 'react/jsx-runtime';
3
+ import { useState, useEffect } from 'react';
4
+ import type { ContentPageContext } from './ContentPageContext';
5
+
6
+ const { jsx, jsxs } = runtime as any;
7
+ setup(jsx, jsxs);
8
+
9
+ const TEST_ORIGIN = 'http://localhost:5001';
10
+
11
+ export const context: ContentPageContext = {
12
+ useState,
13
+ useRouter: () => ({
14
+ href: `${TEST_ORIGIN}/credits`,
15
+ pathname: '/credits',
16
+ query: {},
17
+ push: (url: string) => {
18
+ console.log(url);
19
+ },
20
+ }),
21
+ useAsyncData: (key, fetcher) => {
22
+ const [data, setData] = useState();
23
+ useEffect(() => {
24
+ fetcher().then((_) => {
25
+ setData(_);
26
+ });
27
+ }, [key, fetcher]);
28
+ return { data };
29
+ },
30
+ useLikeService: () => ({
31
+ likeCount: 0,
32
+ like: () => {
33
+ console.log('like');
34
+ },
35
+ dislike: () => {
36
+ console.log('dislike');
37
+ },
38
+ }),
39
+ handlerDecorator:
40
+ (handler, targetContent): any =>
41
+ (ev) => {
42
+ ev.preventDefault();
43
+ console.log(ev.target, ev, targetContent);
44
+ },
45
+ useSearch: () => ({
46
+ term: 'кредит',
47
+ setTerm: (text: string) => console.log(text),
48
+ }),
49
+ };
package/src/types.ts ADDED
@@ -0,0 +1,94 @@
1
+ import type {
2
+ AvifOptions,
3
+ FormatEnum,
4
+ GifOptions,
5
+ HeifOptions,
6
+ JpegOptions,
7
+ PngOptions,
8
+ ResizeOptions,
9
+ TiffOptions,
10
+ WebpOptions,
11
+ } from 'sharp';
12
+ import type { BlockContent } from './Blocks';
13
+ import type { ContentPageContext } from './ContentPageContext';
14
+
15
+ export type ColorPalette = 'pc' | 'bc' | 'eo';
16
+
17
+ export type BlockVersion = 'primary' | 'secondary';
18
+
19
+ export interface BlockDef {
20
+ type: string;
21
+ style?: string[];
22
+ version?: BlockVersion;
23
+ content?: BlockContent;
24
+ blocks?: BlockDef[];
25
+ }
26
+
27
+ export interface ContentPageMeta {
28
+ title: string;
29
+ slug: string;
30
+ description?: string;
31
+ keywords?: string[];
32
+ robots?: string[];
33
+ og?: Record<string, string>;
34
+ }
35
+
36
+ export interface ContentPageDef extends ContentPageMeta {
37
+ style?: string[];
38
+ blocks?: BlockDef[];
39
+ likeControl?: boolean;
40
+ colorPalette?: ColorPalette;
41
+ }
42
+
43
+ export interface Img {
44
+ src: string;
45
+ alt?: string;
46
+ title?: string;
47
+ }
48
+
49
+ export interface ImgSource {
50
+ src: string;
51
+ format?: keyof FormatEnum;
52
+ options?:
53
+ | JpegOptions
54
+ | PngOptions
55
+ | WebpOptions
56
+ | AvifOptions
57
+ | HeifOptions
58
+ | GifOptions
59
+ | TiffOptions;
60
+ size?: ResizeOptions;
61
+ }
62
+
63
+ export interface Picture extends Img, ImgSource {
64
+ sources?: ImgSource[];
65
+ }
66
+
67
+ export interface UniBlockProps {
68
+ className?: string;
69
+ context: ContentPageContext;
70
+ }
71
+
72
+ export interface ContactInfo {
73
+ text: string;
74
+ type: 'tel' | 'email';
75
+ description: string;
76
+ }
77
+
78
+ export interface LinkContent {
79
+ text?: string;
80
+ href?: string;
81
+ target?: '_blank' | '_self' | '_parent' | '_top' | string;
82
+ }
83
+
84
+ export type NavMenuItem = LinkContent;
85
+
86
+ export interface TopMenuItem extends NavMenuItem {
87
+ items?: NavMenuItem[];
88
+ }
89
+
90
+ export interface Benefit {
91
+ label: string;
92
+ description?: string;
93
+ icon?: string;
94
+ }
@@ -0,0 +1,5 @@
1
+ import '../setup-fixture';
2
+
3
+ import { BlockItem } from './BlockItem';
4
+
5
+ export default <BlockItem text="Совершайте любые личные покупки" />;
@@ -0,0 +1,36 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+
3
+ type BlockItemVersion = 'primary' | 'secondary';
4
+ export interface BlockItemContent {
5
+ text?: string;
6
+ }
7
+
8
+ export interface BlockItemProps extends BlockItemContent {
9
+ className?: string;
10
+ version?: BlockItemVersion;
11
+ }
12
+
13
+ const listStyleMap: Record<BlockItemVersion, string> = {
14
+ primary: 'bg-primary-main',
15
+ secondary: 'bg-white',
16
+ };
17
+
18
+ const textStyleMap: Record<BlockItemVersion, string> = {
19
+ primary: 'text-primary-text',
20
+ secondary: 'text-white',
21
+ };
22
+
23
+ export const BlockItem = JSX<BlockItemProps>(
24
+ ({ className, text, children, version = 'primary' }) => {
25
+ return (
26
+ <div className={`inline-block flex ${className || ''}`} role="listitem">
27
+ <div
28
+ className={`inline-block w-[8px] h-[8px] min-w-[8px] min-h-[8px] rounded-full mt-2 ${listStyleMap[version]}`}
29
+ ></div>
30
+ <span className={`text-base font-normal font-sans mx-3 ${textStyleMap[version]}`}>
31
+ {text || children}
32
+ </span>
33
+ </div>
34
+ );
35
+ },
36
+ );
@@ -0,0 +1,26 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { LinkContent } from '../types';
3
+
4
+ export interface BreadcrumbProps extends LinkContent {
5
+ className?: string;
6
+ onClick?: (ev: MouseEvent) => any;
7
+ }
8
+
9
+ export const Breadcrumb = JSX<BreadcrumbProps>(
10
+ ({ text, href, target, onClick, className, children }) => {
11
+ if (href) {
12
+ return (
13
+ <a
14
+ className={`no-underline ${className || ''}`}
15
+ href={href}
16
+ target={target}
17
+ onClick={onClick}
18
+ >
19
+ <span className={`${className || ''}`}>{text || children}</span>
20
+ </a>
21
+ );
22
+ } else {
23
+ return <span className={`${className || ''}`}>{text || children}</span>;
24
+ }
25
+ },
26
+ );
@@ -0,0 +1,113 @@
1
+ import '../setup-fixture';
2
+
3
+ import { Button } from './Button';
4
+
5
+ export default {
6
+ all: (
7
+ <div className="font-sans overflow-hidden">
8
+ <div>
9
+ <p>Private clients</p>
10
+ <div className="flex gap-6" data-theme="pc">
11
+ <Button href="https://www.rshb.ru/" target="_blank" text="Primary" version="primary" />
12
+ <Button
13
+ href="https://www.rshb.ru/"
14
+ target="_blank"
15
+ text="Secondary"
16
+ version="secondary"
17
+ />
18
+ </div>
19
+ </div>
20
+ <div>
21
+ <p>Business clients</p>
22
+ <div className="flex gap-6" data-theme="bc">
23
+ <Button href="https://www.rshb.ru/" target="_blank" text="Primary" version="primary" />
24
+ <Button
25
+ href="https://www.rshb.ru/"
26
+ target="_blank"
27
+ text="Secondary"
28
+ version="secondary"
29
+ />
30
+ </div>
31
+ </div>
32
+ <div>
33
+ <p>Ecosystem own</p>
34
+ <div className="flex gap-6" data-theme="eo">
35
+ <Button href="https://www.rshb.ru/" target="_blank" text="Primary" version="primary" />
36
+ <Button
37
+ href="https://www.rshb.ru/"
38
+ target="_blank"
39
+ text="Secondary"
40
+ version="secondary"
41
+ />
42
+ </div>
43
+ </div>
44
+ <div>
45
+ <p>Disabled</p>
46
+ <div className="flex gap-6">
47
+ <Button
48
+ href="https://www.rshb.ru/"
49
+ target="_blank"
50
+ text="Primary"
51
+ version="primary"
52
+ disabled
53
+ />
54
+ <Button
55
+ href="https://www.rshb.ru/"
56
+ target="_blank"
57
+ text="Secondary"
58
+ version="secondary"
59
+ disabled
60
+ />
61
+ </div>
62
+ </div>
63
+ </div>
64
+ ),
65
+ 'primary (Private clients)': (
66
+ <div data-theme="pc">
67
+ <Button href="https://www.rshb.ru/" target="_blank" text="Сайт РСХБ" version="primary" />
68
+ </div>
69
+ ),
70
+ 'secondary (Private clients)': (
71
+ <div data-theme="pc">
72
+ <Button href="https://www.rshb.ru/" target="_blank" text="Сайт РСХБ" version="secondary" />
73
+ </div>
74
+ ),
75
+ 'primary (Business clients)': (
76
+ <div data-theme="bc">
77
+ <Button href="https://www.rshb.ru/" target="_blank" text="Сайт РСХБ" version="primary" />
78
+ </div>
79
+ ),
80
+ 'secondary (Business clients)': (
81
+ <div data-theme="bc">
82
+ <Button href="https://www.rshb.ru/" target="_blank" text="Сайт РСХБ" version="secondary" />
83
+ </div>
84
+ ),
85
+ 'primary (Ecosystem own)': (
86
+ <div data-theme="eo">
87
+ <Button href="https://www.rshb.ru/" target="_blank" text="Сайт РСХБ" version="primary" />
88
+ </div>
89
+ ),
90
+ 'secondary (Ecosystem own)': (
91
+ <div data-theme="eo">
92
+ <Button href="https://www.rshb.ru/" target="_blank" text="Сайт РСХБ" version="secondary" />
93
+ </div>
94
+ ),
95
+ 'primary (disabled)': (
96
+ <Button
97
+ href="https://www.rshb.ru/"
98
+ target="_blank"
99
+ text="Сайт РСХБ"
100
+ version="primary"
101
+ disabled
102
+ />
103
+ ),
104
+ 'secondary (disabled)': (
105
+ <Button
106
+ href="https://www.rshb.ru/"
107
+ target="_blank"
108
+ text="Сайт РСХБ"
109
+ version="secondary"
110
+ disabled
111
+ />
112
+ ),
113
+ };
@@ -0,0 +1,66 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { LinkContent } from '../types';
3
+
4
+ type ButtonVersion = 'primary' | 'secondary';
5
+ export interface ButtonProps extends LinkContent {
6
+ className?: string;
7
+ onClick?: (ev: MouseEvent) => any;
8
+ version?: ButtonVersion;
9
+ ariaLabel?: string;
10
+ disabled?: Boolean;
11
+ }
12
+
13
+ const buttonStyleMap: Record<ButtonVersion, string> = {
14
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
15
+ secondary:
16
+ 'text-primary-main bg-secondary-light hover:bg-secondary-hover active:bg-secondary-active',
17
+ };
18
+
19
+ const buttonDisabledStyleMap: Record<ButtonVersion, string> = {
20
+ primary: 'bg-secondary-dark text-secondary-text',
21
+ secondary: 'bg-secondary-light text-secondary-text',
22
+ };
23
+
24
+ const styleButton = 'inline-block rounded-md px-9 py-3.5 text-center font-sans';
25
+
26
+ export const Button = JSX<ButtonProps>(
27
+ ({
28
+ className,
29
+ text,
30
+ href,
31
+ target,
32
+ onClick,
33
+ children,
34
+ disabled,
35
+ version = 'primary',
36
+ ariaLabel,
37
+ }) => {
38
+ if (disabled) {
39
+ return (
40
+ <div
41
+ role="button"
42
+ aria-disabled="true"
43
+ aria-label={ariaLabel}
44
+ tabindex="-1"
45
+ className={`${styleButton} select-none ${buttonDisabledStyleMap[version]} ${
46
+ className || ''
47
+ }`}
48
+ >
49
+ <span className="text-sm font-medium">{text || children}</span>
50
+ </div>
51
+ );
52
+ }
53
+
54
+ return (
55
+ <a
56
+ className={`${styleButton} no-underline ${buttonStyleMap[version]} ${className || ''}`}
57
+ href={href}
58
+ target={target}
59
+ onClick={onClick}
60
+ aria-label={ariaLabel}
61
+ >
62
+ <span className="text-sm font-medium">{text || children}</span>
63
+ </a>
64
+ );
65
+ },
66
+ );
@@ -0,0 +1,8 @@
1
+ import '../setup-fixture';
2
+
3
+ import { HeaderItem } from './HeaderItem';
4
+
5
+ export default {
6
+ default: <HeaderItem href="https://www.rshb.ru/" target="_blank" text="Россельхозбанк" />,
7
+ active: <HeaderItem href="https://www.rshb.ru/" target="_blank" text="Россельхозбанк" active />,
8
+ };
@@ -0,0 +1,25 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { TopItemProps } from './TopItem';
3
+
4
+ export type HeaderItemProps = TopItemProps;
5
+
6
+ export const HeaderItem = JSX<HeaderItemProps>(
7
+ ({ className, text, href, target, active, onClick, children }) => {
8
+ const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
9
+ return (
10
+ <a
11
+ className={`relative inline-block bg-transparent text-center no-underline ${
12
+ className || ''
13
+ }`}
14
+ href={href}
15
+ target={target}
16
+ onClick={onClick}
17
+ >
18
+ <span className={`font-sans font-normal text-base ${textStyle}`}>{text || children}</span>
19
+ {active ? (
20
+ <div className="absolute left-0 -bottom-2 w-full h-[2px] bg-primary-main" />
21
+ ) : null}
22
+ </a>
23
+ );
24
+ },
25
+ );
@@ -0,0 +1,6 @@
1
+ import { LikeButton } from './LikeButton';
2
+
3
+ export default {
4
+ default: <LikeButton />,
5
+ rotate: <LikeButton className="rotate-180" />,
6
+ };
@@ -0,0 +1,41 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+
3
+ export interface LikeButtonProps {
4
+ className?: string;
5
+ onClick?: (ev: MouseEvent) => any;
6
+ ariaLabel?: string;
7
+ }
8
+
9
+ export const LikeButton = JSX<LikeButtonProps>(({ className, onClick, ariaLabel }) => (
10
+ <button
11
+ type="button"
12
+ className={`border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`}
13
+ onClick={onClick}
14
+ aria-label={ariaLabel}
15
+ >
16
+ {renderLikeIcon()}
17
+ </button>
18
+ ));
19
+
20
+ const renderLikeIcon = () => {
21
+ const params = {
22
+ stroke: '#292D32',
23
+ strokeLinecap: 'round',
24
+ strokeLinejoin: 'round',
25
+ strokeWidth: '1.5',
26
+ };
27
+
28
+ return (
29
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
30
+ <path
31
+ {...params}
32
+ strokeMiterlimit="10"
33
+ d="M21.48 11.95c.5-1.4-.4-2.6-1.9-2.6h-4c-.6 0-1.1-.5-1-1.2l.5-3.2c.2-.9-.4-1.9-1.3-2.2-.8-.3-1.8.1-2.2.7l-4.1 6.1M7.48 18.35l3.1 2.4c.4.4 1.3.6 1.9.6h3.8c1.2 0 2.5-.9 2.8-2.1l1.24-3.77"
34
+ />
35
+ <path
36
+ {...params}
37
+ d="M2.38 18.35v-9.8c0-1.4.6-1.9 2-1.9h1c1.4 0 2 .5 2 1.9v9.8c0 1.4-.6 1.9-2 1.9h-1c-1.4 0-2-.5-2-1.9Z"
38
+ />
39
+ </svg>
40
+ );
41
+ };
@@ -0,0 +1,5 @@
1
+ import '../setup-fixture';
2
+
3
+ import { Logo } from './Logo';
4
+
5
+ export default <Logo href="https://www.rshb.ru/" />;
@@ -0,0 +1,35 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { SVG } from './SVG';
3
+
4
+ export interface LogoProps {
5
+ className: string;
6
+ href: string;
7
+ targetBlank: boolean;
8
+ }
9
+
10
+ const LOGO_PATHS = [
11
+ 'm13.72 25.51 4.42-4.33v-2.95l-4.42 4.32v2.96Zm0-10.98 4.42-4.35V7.41l-4.42 4.31v2.8Zm0 3.63 4.42-4.33v-2.78l-4.42 4.32v2.8ZM12.46 7.44l-.6-.56V0h-.66v6.22l-.58-.57V0h-.67v5l-.59-.58V0H8.7v6.56l4.44 4.33V0h-.67v7.44Zm1.26 14.35 4.42-4.33v-2.78L13.72 19v2.8Zm-5.03-.61 4.44 4.33v-2.96l-4.44-4.32v2.95Zm8.79-16.76-.59.58V0h-.66v5.66l-.6.56V0h-.66v6.87l-.58.57V0h-.67v10.9l4.42-4.34V0h-.66v4.42Zm-8.79 5.76 4.44 4.35v-2.8L8.69 7.4v2.77Zm0 3.65 4.44 4.33v-2.8l-4.44-4.3v2.77Zm0 3.63 4.44 4.33V19l-4.44-4.31v2.78Zm26.37 2.29H24.3a2.25 2.25 0 0 0 .36-1.22 2.32 2.32 0 0 0-2.33-2.31 2.32 2.32 0 0 0-2.31 2.31c0 .5.16.96.43 1.34a.74.74 0 0 0-.33.61c0 .26.14.49.33.62a2.32 2.32 0 0 0-.43 1.34 2.31 2.31 0 0 0 2.31 2.31 2.32 2.32 0 0 0 2.33-2.31c0-.45-.13-.87-.36-1.22h8.01v.49h-.8v.68h.8v.7h-.8v1.3h.8v-.58h1.17v.58h.79v-1.3h-.79v-.7h.79v-.68h-.79v-.5h1.58a.56.56 0 0 0 .56-.56v-.34a.57.57 0 0 0-.56-.56Zm-11.53 2.7a1.2 1.2 0 0 1-2.4 0c0-.24.08-.47.2-.66l.34-.56a.97.97 0 0 1-.34-.75c0-.3.13-.56.33-.74l-.32-.56a1.13 1.13 0 0 1-.2-.66 1.2 1.2 0 0 1 2.4 0c0 .49-.56 1.65-.56 1.65v.62c-.01.01.55 1.17.55 1.66ZM4.67 18.34v2.89c0 2.75 1.2 4.53 1.9 5.21l4.58 4.5c1.28 1.25 1.5 1.66 1.79 2.37v-3.2c0-2.84-1.44-3.94-2.19-4.67-1.73-1.68-2.89-2.8-3.82-3.73a8.98 8.98 0 0 1-2.26-3.37Zm6.08 14.24c-1.73-1.7-2.89-2.8-3.82-3.73a10 10 0 0 1-2.25-2.98v2.49a7.87 7.87 0 0 0 1.89 5.24l4.58 4.47c1.28 1.25 1.5 1.85 1.79 2.55v-3.37c0-2.85-1.45-3.95-2.19-4.67Z',
12
+ 'M19.88 5.34c-.32 0-.64 0-.96.02V6.7a18.5 18.5 0 1 1 .95 36.94A18.5 18.5 0 0 1 1.35 25.17c0-5.67 2.55-10.73 6.58-14.13V9.32A19.78 19.78 0 0 0 0 25.17C0 36.12 8.9 45 19.88 45a19.85 19.85 0 0 0 19.86-19.83c0-10.95-8.9-19.83-19.87-19.83Z',
13
+ 'M33.93 35.53c.3-.41.6-.85.87-1.3v-2.66h-.87v3.96Zm2.54-4.92c.12-.4.24-.78.34-1.16h-2.88v.7h.43c.77-.02 1.63-.03 2.11.46Zm-19.19-1.27h-.78v7.91h.78v-7.9Z',
14
+ 'M14.7 27.83h2.58c.67 0 1.14.14 1.4.4.27.25.4.72.4 1.38v7.4c0 .66-.12 1.12-.4 1.38-.4.41-1.16.41-1.78.41l-.4-.01v3.5l.78.14v-2.88c1.2 0 1.97-.4 2.34-1.22v4.29h.26l.5-.01V29.74c0-.68.13-1.16.4-1.43.25-.27.72-.4 1.37-.4.67 0 1.65-.1 2.16.4.26.27.38.76.38 1.43v3.8h-1.77v-4.06h-.77v12.99c.26-.03.5-.07.77-.12V34.3h1.77v7.64c.36-.1.72-.21 1.08-.34v-7c0-.8.19-1.4 1-1.67l-.9-4.87h1.8l.3 5.31h.22l.3-5.31h1.88l-1.01 4.87c.84.3 1.01.81 1.01 1.66v4.53a16.63 16.63 0 0 0 1.5-1.27v-9.83h5.25l.1-.72H24.93l.17.89c-.38-.72-1.12-1.08-2.2-1.08h-.77c-1.3 0-2.1.52-2.4 1.55-.27-1.08-1.1-1.62-2.46-1.62h-3.36v14.52c.26.09.52.18.78.25V27.84Zm16.29 5.58-.85-.8.85-4.37v5.17Z',
15
+ 'M27.66 40.79c.27-.14.55-.28.8-.43v-5.98h-.8v6.4Z',
16
+ ];
17
+
18
+ export const Logo = JSX<Partial<LogoProps>>(({ className, href, children, targetBlank }) => {
19
+ return (
20
+ <a
21
+ className={`inline-flex items-center font-sans no-underline ${className || ''}`}
22
+ href={href || 'https://rshb.ru/'}
23
+ target={targetBlank ? '_blank' : '_self'}
24
+ >
25
+ <SVG
26
+ className="text-primary-main w-10"
27
+ viewBox="0 0 40 45"
28
+ paths={LOGO_PATHS.map((d) => ({ d }))}
29
+ />
30
+ <span className="text-black text-base font-medium ml-2.5">
31
+ {children || 'Россельхозбанк'}
32
+ </span>
33
+ </a>
34
+ );
35
+ });
@@ -0,0 +1,32 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+
3
+ interface SVGPathOptions {
4
+ fill?: string;
5
+ stroke?: string;
6
+ strokeLinecap?: string;
7
+ strokeLinejoin?: string;
8
+ strokeWidth?: string;
9
+ strokeMiterlimit?: string;
10
+ }
11
+
12
+ interface SVGPath extends SVGPathOptions {
13
+ d: string;
14
+ }
15
+
16
+ export interface SVGProps extends SVGPathOptions {
17
+ className?: string;
18
+ viewBox?: string;
19
+ paths: SVGPath[];
20
+ }
21
+
22
+ export const SVG = JSX<SVGProps>(
23
+ ({ className, viewBox, fill = 'none', paths, ...commonOptions }) => {
24
+ return (
25
+ <svg xmlns="http://www.w3.org/2000/svg" className={className} viewBox={viewBox} fill={fill}>
26
+ {paths.map(({ d, fill, ...options }, i) => (
27
+ <path key={i} d={d} fill={fill || 'currentColor'} {...commonOptions} {...options} />
28
+ ))}
29
+ </svg>
30
+ );
31
+ },
32
+ );
@@ -0,0 +1,33 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { UniBlockProps } from '../types';
3
+ import { LoupeIcon } from '../Icons/index';
4
+
5
+ export const SearchBar = JSX<UniBlockProps>(({ className, context }) => {
6
+ const search = context.useSearch();
7
+ return (
8
+ <form className={`relative ${className || ''}`}>
9
+ <div className="absolute rounded-l-full h-full flex items-center justify-center pl-4 max-w-[170px] gap-3.5">
10
+ <div className="w-[24px] h-[24px]">{LoupeIcon()}</div>
11
+ <span className="font-sans font-normal text-sm text-secondary-text">Поиск по сайту</span>
12
+ </div>
13
+ <input
14
+ className="pl-[170px] w-full font-sans font-normal text-sm border border-solid border-main-divider rounded-full h-full box-border outline-none"
15
+ value={search.term}
16
+ onChange={(e) => search.setTerm(e.target.value)}
17
+ type="text"
18
+ placeholder="Поиск по сайту"
19
+ name="s"
20
+ />
21
+ <button
22
+ type="submit"
23
+ className="absolute font-sans font-normal text-sm cursor-pointer bg-transparent hover:bg-primary-hover active:bg-primary-active text-primary-main hover:text-white border-none px-5 rounded-r-full h-full top-0 right-0 outline-none"
24
+ onClick={(e) => {
25
+ e.preventDefault();
26
+ console.log('click');
27
+ }}
28
+ >
29
+ Найти
30
+ </button>
31
+ </form>
32
+ );
33
+ });
@@ -0,0 +1,8 @@
1
+ import '../setup-fixture';
2
+
3
+ import { TopItem } from './TopItem';
4
+
5
+ export default {
6
+ default: <TopItem href="https://www.rshb.ru/" target="_blank" text="Экосистема Своё" />,
7
+ active: <TopItem href="https://www.rshb.ru/" target="_blank" text="Экосистема Своё" active />,
8
+ };