@redneckz/wildless-cms-uni-blocks 0.2.56 → 0.2.59
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.
- package/dist/BaseTile.d.ts +4 -3
- package/dist/BaseTile.js +24 -11
- package/dist/BaseTile.js.map +1 -1
- package/dist/Blocks.d.ts +3 -1
- package/dist/Blocks.js +2 -0
- package/dist/Blocks.js.map +1 -1
- package/dist/Icons/AppleIcon.d.ts +1 -0
- package/dist/Icons/AppleIcon.js +6 -0
- package/dist/Icons/AppleIcon.js.map +1 -0
- package/dist/Icons/PlayMarket.d.ts +1 -0
- package/dist/Icons/PlayMarket.js +6 -0
- package/dist/Icons/PlayMarket.js.map +1 -0
- package/dist/Icons/index.d.ts +2 -0
- package/dist/Icons/index.js +5 -1
- package/dist/Icons/index.js.map +1 -1
- package/dist/MobileAppTile.d.ts +2 -1
- package/dist/MobileAppTile.js +2 -2
- package/dist/MobileAppTile.js.map +1 -1
- package/dist/ProductBlock.js +1 -1
- package/dist/ProductBlock.js.map +1 -1
- package/dist/ProductBlockInner.js +1 -1
- package/dist/ProductBlockInner.js.map +1 -1
- package/dist/ProductGallery.js +1 -1
- package/dist/ProductGallery.js.map +1 -1
- package/dist/ProductTile.js +3 -3
- package/dist/ProductTile.js.map +1 -1
- package/dist/PromoTile.d.ts +8 -0
- package/dist/PromoTile.js +18 -0
- package/dist/PromoTile.js.map +1 -0
- package/dist/Tile.js +14 -1
- package/dist/Tile.js.map +1 -1
- package/dist/api/DaDataAPI.js +2 -2
- package/dist/api/DaDataAPI.js.map +1 -1
- package/dist/content-page-repository/ContentPageRepository.js +1 -1
- package/dist/content-page-repository/ContentPageRepository.js.map +1 -1
- package/dist/content-page-repository/index.d.ts +0 -1
- package/dist/content-page-repository/index.js +1 -3
- package/dist/content-page-repository/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/{content-page-repository/toMobilePage.d.ts → toMobilePage.d.ts} +1 -1
- package/dist/{content-page-repository/toMobilePage.js → toMobilePage.js} +0 -0
- package/dist/toMobilePage.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/ui-kit/Button.d.ts +1 -3
- package/dist/ui-kit/Button.js +3 -3
- package/dist/ui-kit/Button.js.map +1 -1
- package/dist/ui-kit/IconButton.d.ts +6 -0
- package/dist/ui-kit/IconButton.js +11 -0
- package/dist/ui-kit/IconButton.js.map +1 -0
- package/dist/utils/getColSpan.d.ts +1 -0
- package/dist/utils/getColSpan.js +9 -0
- package/dist/utils/getColSpan.js.map +1 -0
- package/dist/utils/getGeolocation.d.ts +1 -0
- package/dist/utils/getGeolocation.js +5 -0
- package/dist/utils/getGeolocation.js.map +1 -0
- package/lib/BaseTile.d.ts +4 -3
- package/lib/BaseTile.js +24 -11
- package/lib/BaseTile.js.map +1 -1
- package/lib/Blocks.d.ts +3 -1
- package/lib/Blocks.js +2 -0
- package/lib/Blocks.js.map +1 -1
- package/lib/Icons/AppleIcon.d.ts +1 -0
- package/lib/Icons/AppleIcon.js +3 -0
- package/lib/Icons/AppleIcon.js.map +1 -0
- package/lib/Icons/PlayMarket.d.ts +1 -0
- package/lib/Icons/PlayMarket.js +3 -0
- package/lib/Icons/PlayMarket.js.map +1 -0
- package/lib/Icons/index.d.ts +2 -0
- package/lib/Icons/index.js +2 -0
- package/lib/Icons/index.js.map +1 -1
- package/lib/MobileAppTile.d.ts +2 -1
- package/lib/MobileAppTile.js +2 -2
- package/lib/MobileAppTile.js.map +1 -1
- package/lib/MobileBlocks.js +1 -1
- package/lib/ProductBlock.js +1 -1
- package/lib/ProductBlock.js.map +1 -1
- package/lib/ProductBlockInner.js +1 -1
- package/lib/ProductBlockInner.js.map +1 -1
- package/lib/ProductGallery.js +1 -1
- package/lib/ProductGallery.js.map +1 -1
- package/lib/ProductTile.js +3 -3
- package/lib/ProductTile.js.map +1 -1
- package/lib/PromoTile.d.ts +8 -0
- package/lib/PromoTile.js +16 -0
- package/lib/PromoTile.js.map +1 -0
- package/lib/Tile.js +14 -1
- package/lib/Tile.js.map +1 -1
- package/lib/api/DaDataAPI.js +2 -2
- package/lib/api/DaDataAPI.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/content-page-repository/ContentPageRepository.js +1 -1
- package/lib/content-page-repository/ContentPageRepository.js.map +1 -1
- package/lib/content-page-repository/index.d.ts +0 -1
- package/lib/content-page-repository/index.js +0 -1
- package/lib/content-page-repository/index.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/{content-page-repository/toMobilePage.d.ts → toMobilePage.d.ts} +1 -1
- package/lib/{content-page-repository/toMobilePage.js → toMobilePage.js} +0 -0
- package/lib/toMobilePage.js.map +1 -0
- package/lib/types.d.ts +2 -0
- package/lib/ui-kit/Button.d.ts +1 -3
- package/lib/ui-kit/Button.js +3 -3
- package/lib/ui-kit/Button.js.map +1 -1
- package/lib/ui-kit/IconButton.d.ts +6 -0
- package/lib/ui-kit/IconButton.js +9 -0
- package/lib/ui-kit/IconButton.js.map +1 -0
- package/lib/utils/getColSpan.d.ts +1 -0
- package/lib/utils/getColSpan.js +6 -0
- package/lib/utils/getColSpan.js.map +1 -0
- package/lib/utils/getGeolocation.d.ts +1 -0
- package/lib/utils/getGeolocation.js +2 -0
- package/lib/utils/getGeolocation.js.map +1 -0
- package/package.json +1 -1
- package/src/BaseTile.tsx +34 -18
- package/src/Blocks.ts +3 -0
- package/src/ContentPage.fixture.tsx +1 -1
- package/src/ContentPage.page.json +35 -22
- package/src/Icons/AppleIcon.tsx +15 -0
- package/src/Icons/PlayMarket.tsx +8 -0
- package/src/Icons/index.ts +2 -0
- package/src/MobileAppTile.tsx +4 -3
- package/src/ProductBlock.tsx +3 -1
- package/src/ProductBlockInner.tsx +3 -3
- package/src/ProductGallery.tsx +7 -3
- package/src/ProductTile.tsx +3 -3
- package/src/PromoTile.tsx +47 -0
- package/src/Tile.tsx +18 -1
- package/src/api/DaDataAPI.ts +2 -2
- package/src/content-page-repository/ContentPageRepository.ts +1 -1
- package/src/content-page-repository/index.ts +0 -1
- package/src/index.ts +4 -1
- package/src/{content-page-repository/toMobilePage.ts → toMobilePage.ts} +1 -1
- package/src/types.ts +2 -0
- package/src/ui-kit/Button.fixture.tsx +22 -0
- package/src/ui-kit/Button.tsx +12 -5
- package/src/ui-kit/IconButton.tsx +27 -0
- package/src/utils/getColSpan.ts +5 -0
- package/src/utils/{getCurrentPosition.ts → getGeolocation.ts} +1 -1
- package/dist/content-page-repository/toMobilePage.js.map +0 -1
- package/dist/utils/getCurrentPosition.d.ts +0 -1
- package/dist/utils/getCurrentPosition.js +0 -5
- package/dist/utils/getCurrentPosition.js.map +0 -1
- package/lib/content-page-repository/toMobilePage.js.map +0 -1
- package/lib/utils/getCurrentPosition.d.ts +0 -1
- package/lib/utils/getCurrentPosition.js +0 -2
- package/lib/utils/getCurrentPosition.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { LikeAPI } from './api/LikeAPI.js';
|
|
|
3
3
|
export { DaDataAPI } from './api/DaDataAPI.js';
|
|
4
4
|
export { ContentPageHead } from './ContentPageHead.js';
|
|
5
5
|
export { ContentPage } from './ContentPage.js';
|
|
6
|
+
export { toMobilePage } from './toMobilePage.js';
|
|
6
7
|
export { Blocks } from './Blocks.js';
|
|
7
8
|
export { MobileBlocks } from './MobileBlocks.js';
|
|
8
9
|
export * as url from './utils/url.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAqB5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ContentPageDef } from '
|
|
1
|
+
import type { ContentPageDef } from './types';
|
|
2
2
|
export declare function toMobilePage(contentPage: ContentPageDef): ContentPageDef;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMobilePage.js","sourceRoot":"","sources":["../src/toMobilePage.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,WAA2B;IACtD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9F,OAAO;QACL,GAAG,WAAW;QACd,MAAM;KACP,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAe;IACpC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,IAAI,MAAM,EAAE;QACV,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;SACzD,CAAC;KACH;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { BlockContent } from './Blocks';
|
|
|
3
3
|
import type { ContentPageContext } from './ContentPageContext';
|
|
4
4
|
export declare type ColorPalette = 'pc' | 'bc' | 'eo';
|
|
5
5
|
export declare type BlockVersion = 'primary' | 'secondary';
|
|
6
|
+
export declare type ButtonVersion = 'primary' | 'secondary';
|
|
7
|
+
export declare type TitleSize = 'S' | 'M' | 'L' | 'XL';
|
|
6
8
|
export interface BlockDef {
|
|
7
9
|
type: string;
|
|
8
10
|
style?: string[];
|
package/lib/ui-kit/Button.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { LinkContent } from '../types';
|
|
2
|
-
declare type ButtonVersion = 'primary' | 'secondary';
|
|
1
|
+
import type { ButtonVersion, LinkContent } from '../types';
|
|
3
2
|
export interface ButtonProps extends LinkContent {
|
|
4
3
|
className?: string;
|
|
5
4
|
onClick?: (ev: MouseEvent) => any;
|
|
@@ -8,4 +7,3 @@ export interface ButtonProps extends LinkContent {
|
|
|
8
7
|
disabled?: Boolean;
|
|
9
8
|
}
|
|
10
9
|
export declare const Button: (props: import("@redneckz/uni-jsx").PropsWithChildren<ButtonProps, any>, context?: any) => any;
|
|
11
|
-
export {};
|
package/lib/ui-kit/Button.js
CHANGED
|
@@ -8,11 +8,11 @@ const buttonDisabledStyleMap = {
|
|
|
8
8
|
primary: 'bg-secondary-dark text-secondary-text',
|
|
9
9
|
secondary: 'bg-secondary-light text-secondary-text',
|
|
10
10
|
};
|
|
11
|
-
const styleButton = 'inline-block rounded-md px-
|
|
11
|
+
const styleButton = 'inline-block rounded-md px-8 py-2 text-center font-sans';
|
|
12
12
|
export const Button = JSX(({ className, text, href, target, onClick, children, disabled, version = 'primary', ariaLabel, }) => {
|
|
13
13
|
if (disabled) {
|
|
14
|
-
return (_jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabindex: "-1", className: `${styleButton} select-none ${buttonDisabledStyleMap[version]} ${className || ''}`, children: _jsx("
|
|
14
|
+
return (_jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabindex: "-1", className: `${styleButton} select-none ${buttonDisabledStyleMap[version]} ${className || ''}`, children: children ? (_jsx("div", { children: children })) : (_jsx("div", { className: "text-sm font-medium py-1.5", children: text })) }));
|
|
15
15
|
}
|
|
16
|
-
return (_jsx("a", { className: `${styleButton} no-underline ${buttonStyleMap[version]} ${className || ''}`, href: href, target: target, onClick: onClick, "aria-label": ariaLabel, children: _jsx("
|
|
16
|
+
return (_jsx("a", { className: `${styleButton} no-underline ${buttonStyleMap[version]} ${className || ''}`, href: href, target: target, onClick: onClick, "aria-label": ariaLabel, children: children ? (_jsx("div", { children: children })) : (_jsx("div", { className: "text-sm font-medium py-1.5", children: text })) }));
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=Button.js.map
|
package/lib/ui-kit/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/ui-kit/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/ui-kit/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAWxC,MAAM,cAAc,GAAkC;IACpD,OAAO,EAAE,4EAA4E;IACrF,SAAS,EACP,0FAA0F;CAC7F,CAAC;AAEF,MAAM,sBAAsB,GAAkC;IAC5D,OAAO,EAAE,uCAAuC;IAChD,SAAS,EAAE,wCAAwC;CACpD,CAAC;AAEF,MAAM,WAAW,GAAG,yDAAyD,CAAC;AAE9E,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CACvB,CAAC,EACC,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,SAAS,GACV,EAAE,EAAE;IACH,IAAI,QAAQ,EAAE;QACZ,OAAO,CACL,cACE,IAAI,EAAC,QAAQ,mBACC,MAAM,gBACR,SAAS,EACrB,QAAQ,EAAC,IAAI,EACb,SAAS,EAAE,GAAG,WAAW,gBAAgB,sBAAsB,CAAC,OAAO,CAAC,IACtE,SAAS,IAAI,EACf,EAAE,YAED,QAAQ,CAAC,CAAC,CAAC,CACV,wBAAM,QAAQ,GAAO,CACtB,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,4BAA4B,YAAE,IAAI,GAAO,CACzD,GACG,CACP,CAAC;KACH;IAED,OAAO,CACL,YACE,SAAS,EAAE,GAAG,WAAW,iBAAiB,cAAc,CAAC,OAAO,CAAC,IAAI,SAAS,IAAI,EAAE,EAAE,EACtF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,gBACJ,SAAS,YAEpB,QAAQ,CAAC,CAAC,CAAC,CACV,wBAAM,QAAQ,GAAO,CACtB,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,4BAA4B,YAAE,IAAI,GAAO,CACzD,GACC,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ButtonProps } from './Button';
|
|
2
|
+
export interface IconButtonProps extends ButtonProps {
|
|
3
|
+
icon?: string;
|
|
4
|
+
aboveText?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const IconButton: (props: import("@redneckz/uni-jsx").PropsWithChildren<IconButtonProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { AppleIcon, PlayMarket } from '../Icons.js';
|
|
4
|
+
import { Button } from './Button.js';
|
|
5
|
+
const ICONS = { AppleIcon, PlayMarket };
|
|
6
|
+
export const IconButton = JSX((props) => {
|
|
7
|
+
return (_jsx(Button, { ...props, children: props.icon ? (_jsxs("div", { className: "flex items-center", children: [_jsx("div", { className: "mr-2", children: ICONS[props.icon]?.() }), _jsxs("div", { children: [_jsx("div", { className: "text-xxs text-left", children: props.aboveText }), _jsx("div", { className: "text-sm font-medium text-left", children: props.text })] })] })) : null }));
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../src/ui-kit/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,KAAK,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAOxC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAkB,CAAC,KAAK,EAAE,EAAE;IACvD,OAAO,CACL,KAAC,MAAM,OAAK,KAAK,YACd,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACZ,eAAK,SAAS,EAAC,mBAAmB,aAChC,cAAK,SAAS,EAAC,MAAM,YAAE,KAAK,CAAC,KAAK,CAAC,IAA0B,CAAC,EAAE,EAAE,GAAO,EACzE,0BACE,cAAK,SAAS,EAAC,oBAAoB,YAAE,KAAK,CAAC,SAAS,GAAO,EAC3D,cAAK,SAAS,EAAC,+BAA+B,YAAE,KAAK,CAAC,IAAI,GAAO,IAC7D,IACF,CACP,CAAC,CAAC,CAAC,IAAI,GACD,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getColSpan: (className: string) => number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getColSpan = (className) => {
|
|
2
|
+
const colSpanPrefix = 'col-span-';
|
|
3
|
+
const colSpanStr = className.split(/\s+/).find((_) => _.startsWith(colSpanPrefix));
|
|
4
|
+
return colSpanStr ? parseInt(colSpanStr.substring(colSpanPrefix.length), 10) : 12;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=getColSpan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getColSpan.js","sourceRoot":"","sources":["../../src/utils/getColSpan.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC9C,MAAM,aAAa,GAAG,WAAW,CAAC;IAClC,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;IACnF,OAAO,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACpF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getGeolocation: () => Promise<GeolocationCoordinates>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGeolocation.js","sourceRoot":"","sources":["../../src/utils/getGeolocation.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE,CACvC,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,EAAE,CAC9C,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAC1E,CAAC"}
|
package/package.json
CHANGED
package/src/BaseTile.tsx
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { Img } from './Img';
|
|
3
|
-
import type { BlockVersion, Picture, UniBlockProps } from './types';
|
|
3
|
+
import type { BlockVersion, Picture, UniBlockProps, TitleSize } from './types';
|
|
4
4
|
import { BlockItem } from './ui-kit/BlockItem';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
5
|
+
import type { IconButtonProps } from './ui-kit/IconButton';
|
|
6
|
+
import { IconButton } from './ui-kit/IconButton';
|
|
7
7
|
import { useLink } from './useLink';
|
|
8
|
+
import { getColSpan } from './utils/getColSpan';
|
|
8
9
|
|
|
9
10
|
export interface BaseTileContent {
|
|
10
11
|
title?: string;
|
|
12
|
+
titleSize?: TitleSize;
|
|
11
13
|
description?: string;
|
|
12
14
|
image?: Picture;
|
|
13
15
|
items?: string[];
|
|
14
|
-
buttons?:
|
|
16
|
+
buttons?: IconButtonProps[];
|
|
15
17
|
version?: BlockVersion;
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -23,6 +25,7 @@ export const BaseTile = JSX<BaseTileProps>(
|
|
|
23
25
|
className,
|
|
24
26
|
context,
|
|
25
27
|
title,
|
|
28
|
+
titleSize,
|
|
26
29
|
description,
|
|
27
30
|
children,
|
|
28
31
|
buttons,
|
|
@@ -34,41 +37,54 @@ export const BaseTile = JSX<BaseTileProps>(
|
|
|
34
37
|
const { handlerDecorator } = context;
|
|
35
38
|
return (
|
|
36
39
|
<div className={`font-sans flex flex-col grow h-full`}>
|
|
37
|
-
{title && renderTitle(title, className)}
|
|
38
|
-
<div className="flex grow justify-between
|
|
40
|
+
{title && renderTitle(title, titleSize || getTitleSizeByClassName(className))}
|
|
41
|
+
<div className="flex grow justify-between">
|
|
39
42
|
<div className="flex flex-col justify-between items-start">
|
|
40
43
|
<div>
|
|
41
44
|
{description ? (
|
|
42
|
-
<div className="font-normal text-base max-w-[600px] mb-
|
|
45
|
+
<div className="font-normal text-base max-w-[600px] mb-5">{description}</div>
|
|
43
46
|
) : null}
|
|
44
47
|
{children}
|
|
45
48
|
{items?.length ? renderItems(items, version) : null}
|
|
46
49
|
</div>
|
|
47
50
|
{buttons?.length ? (
|
|
48
|
-
<div className="flex mt-
|
|
51
|
+
<div className="flex mt-9 gap-3">
|
|
49
52
|
{buttons.map((button, index) =>
|
|
50
53
|
renderButton(useLink({ router, handlerDecorator }, button), index),
|
|
51
54
|
)}
|
|
52
55
|
</div>
|
|
53
56
|
) : null}
|
|
54
57
|
</div>
|
|
55
|
-
{image?.src && <Img className="mt-auto" image={image} />}
|
|
58
|
+
{image?.src && <Img className="mt-auto ml-7" image={image} />}
|
|
56
59
|
</div>
|
|
57
60
|
</div>
|
|
58
61
|
);
|
|
59
62
|
},
|
|
60
63
|
);
|
|
61
64
|
|
|
62
|
-
function renderTitle(title: string,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
function renderTitle(title: string, titleSize: TitleSize) {
|
|
66
|
+
switch (titleSize) {
|
|
67
|
+
case 'XL':
|
|
68
|
+
return <h1 className={`${TITLE_CLASSES} text-title-lg`}>{title}</h1>;
|
|
69
|
+
case 'L':
|
|
70
|
+
return <h2 className={`${TITLE_CLASSES} text-title`}>{title}</h2>;
|
|
71
|
+
case 'M':
|
|
72
|
+
return <h2 className={`${TITLE_CLASSES} text-title-sm`}>{title}</h2>;
|
|
73
|
+
case 'S':
|
|
74
|
+
return <h2 className={`${TITLE_CLASSES} text-title-xs`}>{title}</h2>;
|
|
75
|
+
default:
|
|
76
|
+
return <h2 className={`${TITLE_CLASSES} text-title`}>{title}</h2>;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getTitleSizeByClassName(className: string = '') {
|
|
81
|
+
const colSpan = getColSpan(className);
|
|
66
82
|
if (colSpan <= 4) {
|
|
67
|
-
return
|
|
83
|
+
return 'S';
|
|
68
84
|
} else if (colSpan <= 8) {
|
|
69
|
-
return
|
|
85
|
+
return 'M';
|
|
70
86
|
} else {
|
|
71
|
-
return
|
|
87
|
+
return 'L';
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
|
|
@@ -82,6 +98,6 @@ function renderItems(items: string[] = [], version?: BlockVersion) {
|
|
|
82
98
|
);
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
function renderButton(button:
|
|
86
|
-
return button?.text ? <
|
|
101
|
+
function renderButton(button: IconButtonProps, i: number) {
|
|
102
|
+
return button?.text ? <IconButton key={String(i)} {...button} /> : null;
|
|
87
103
|
}
|
package/src/Blocks.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ProductGallery, ProductGalleryContent } from './ProductGallery';
|
|
|
10
10
|
import { StepsBlock, StepsBlockContent } from './StepsBlock';
|
|
11
11
|
import { ProductTile, ProductTileContent } from './ProductTile';
|
|
12
12
|
import { BaseTileContent } from './BaseTile';
|
|
13
|
+
import { PromoTile, PromoTileContent } from './PromoTile';
|
|
13
14
|
import { Tile } from './Tile';
|
|
14
15
|
|
|
15
16
|
export const Blocks = {
|
|
@@ -17,6 +18,7 @@ export const Blocks = {
|
|
|
17
18
|
Footer,
|
|
18
19
|
Placeholder,
|
|
19
20
|
Tile,
|
|
21
|
+
PromoTile,
|
|
20
22
|
ProductTile,
|
|
21
23
|
ProductBlock,
|
|
22
24
|
StepsBlock,
|
|
@@ -32,6 +34,7 @@ export type BlockContent =
|
|
|
32
34
|
| PlaceholderContent
|
|
33
35
|
| BaseTileContent
|
|
34
36
|
| ProductTileContent
|
|
37
|
+
| PromoTileContent
|
|
35
38
|
| ProductBlockInnerContent
|
|
36
39
|
| StepsBlockContent
|
|
37
40
|
| BenefitsBlockContent
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { context } from './setup-fixture';
|
|
2
2
|
|
|
3
3
|
import { Blocks } from './Blocks';
|
|
4
|
-
import { toMobilePage } from './content-page-repository/toMobilePage';
|
|
5
4
|
import { BlockDecorator, ContentPage } from './ContentPage';
|
|
6
5
|
import { MobileBlocks } from './MobileBlocks';
|
|
6
|
+
import { toMobilePage } from './toMobilePage';
|
|
7
7
|
import type { ContentPageDef } from './types';
|
|
8
8
|
|
|
9
9
|
const data = require('./ContentPage.page.json');
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
},
|
|
75
75
|
"productBlock": {
|
|
76
76
|
"title": "Ставка от 12,5% годовых на срок до 3 лет!»",
|
|
77
|
-
"description": "Кредит наличными без залога и поручительства. Потребительский кредит на любые цели. Нужен только паспорт.",
|
|
78
77
|
"items": [
|
|
79
78
|
"Потребительский кредит по специальной процентной ставке",
|
|
80
79
|
"Получите деньги без залога и поручительства",
|
|
@@ -107,11 +106,6 @@
|
|
|
107
106
|
"productBlock": {
|
|
108
107
|
"title": "Дополнительные бонусные баллы за покупки!»",
|
|
109
108
|
"description": "Кредит наличными без залога и поручительства. Потребительский кредит на любые цели. Нужен только паспорт.",
|
|
110
|
-
"items": [
|
|
111
|
-
"Потребительский кредит по специальной процентной ставке",
|
|
112
|
-
"Получите деньги без залога и поручительства",
|
|
113
|
-
"Кредитный лимит до 5 млн рублей"
|
|
114
|
-
],
|
|
115
109
|
"buttons": [
|
|
116
110
|
{
|
|
117
111
|
"href": "https://rshb.ru",
|
|
@@ -188,8 +182,8 @@
|
|
|
188
182
|
"title": "деньги",
|
|
189
183
|
"format": "webp",
|
|
190
184
|
"size": {
|
|
191
|
-
"width":
|
|
192
|
-
"height":
|
|
185
|
+
"width": 180,
|
|
186
|
+
"height": 180
|
|
193
187
|
}
|
|
194
188
|
}
|
|
195
189
|
},
|
|
@@ -203,6 +197,7 @@
|
|
|
203
197
|
"style": ["col-span-4"],
|
|
204
198
|
"content": {
|
|
205
199
|
"title": "Ипотека",
|
|
200
|
+
"titleSize": "M",
|
|
206
201
|
"description": "Широкий выбор ипотечных программ с государственной поддержкой. Специальный предложения от 12,2 %",
|
|
207
202
|
"buttons": [
|
|
208
203
|
{
|
|
@@ -235,8 +230,8 @@
|
|
|
235
230
|
"title": "Кредитка",
|
|
236
231
|
"format": "webp",
|
|
237
232
|
"size": {
|
|
238
|
-
"width":
|
|
239
|
-
"height":
|
|
233
|
+
"width": 180,
|
|
234
|
+
"height": 180
|
|
240
235
|
}
|
|
241
236
|
}
|
|
242
237
|
},
|
|
@@ -262,8 +257,8 @@
|
|
|
262
257
|
"alt": "Column",
|
|
263
258
|
"format": "webp",
|
|
264
259
|
"size": {
|
|
265
|
-
"width":
|
|
266
|
-
"height":
|
|
260
|
+
"width": 180,
|
|
261
|
+
"height": 180
|
|
267
262
|
}
|
|
268
263
|
}
|
|
269
264
|
},
|
|
@@ -294,8 +289,8 @@
|
|
|
294
289
|
"title": "Глобус",
|
|
295
290
|
"format": "webp",
|
|
296
291
|
"size": {
|
|
297
|
-
"width":
|
|
298
|
-
"height":
|
|
292
|
+
"width": 200,
|
|
293
|
+
"height": 200
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
296
|
}
|
|
@@ -359,11 +354,12 @@
|
|
|
359
354
|
}
|
|
360
355
|
},
|
|
361
356
|
{
|
|
362
|
-
"type": "
|
|
357
|
+
"type": "PromoTile",
|
|
363
358
|
"style": ["col-span-4"],
|
|
364
359
|
"content": {
|
|
365
360
|
"title": "Акции и спецпредложения",
|
|
366
361
|
"version": "secondary",
|
|
362
|
+
"date": "2022-04-16",
|
|
367
363
|
"description": "Пенсионный кредит по специальной процентной ставке",
|
|
368
364
|
"buttons": [
|
|
369
365
|
{
|
|
@@ -395,7 +391,23 @@
|
|
|
395
391
|
},
|
|
396
392
|
"mobile": {
|
|
397
393
|
"style": ["col-span-12"]
|
|
398
|
-
}
|
|
394
|
+
},
|
|
395
|
+
"buttons": [
|
|
396
|
+
{
|
|
397
|
+
"aboveText": "Загрузите в",
|
|
398
|
+
"text": "App Store",
|
|
399
|
+
"icon": "AppleIcon",
|
|
400
|
+
"href": "/credits",
|
|
401
|
+
"version": "secondary"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"aboveText": "Доступно в",
|
|
405
|
+
"text": "Google Play",
|
|
406
|
+
"icon": "PlayMarket",
|
|
407
|
+
"href": "/credits",
|
|
408
|
+
"version": "secondary"
|
|
409
|
+
}
|
|
410
|
+
]
|
|
399
411
|
},
|
|
400
412
|
{
|
|
401
413
|
"type": "Unknown",
|
|
@@ -497,8 +509,8 @@
|
|
|
497
509
|
"alt": "Кредиты в РСХБ",
|
|
498
510
|
"format": "webp",
|
|
499
511
|
"size": {
|
|
500
|
-
"width":
|
|
501
|
-
"height":
|
|
512
|
+
"width": 180,
|
|
513
|
+
"height": 180
|
|
502
514
|
}
|
|
503
515
|
}
|
|
504
516
|
},
|
|
@@ -539,8 +551,8 @@
|
|
|
539
551
|
"alt": "Пенсионный кредит в РСХБ",
|
|
540
552
|
"format": "webp",
|
|
541
553
|
"size": {
|
|
542
|
-
"width":
|
|
543
|
-
"height":
|
|
554
|
+
"width": 180,
|
|
555
|
+
"height": 180
|
|
544
556
|
}
|
|
545
557
|
}
|
|
546
558
|
},
|
|
@@ -581,8 +593,8 @@
|
|
|
581
593
|
"alt": "Кредит под залог недвижимости в РСХБ",
|
|
582
594
|
"format": "webp",
|
|
583
595
|
"size": {
|
|
584
|
-
"width":
|
|
585
|
-
"height":
|
|
596
|
+
"width": 180,
|
|
597
|
+
"height": 180
|
|
586
598
|
}
|
|
587
599
|
}
|
|
588
600
|
},
|
|
@@ -596,6 +608,7 @@
|
|
|
596
608
|
"version": "secondary",
|
|
597
609
|
"content": {
|
|
598
610
|
"title": "Кредит пенсионный",
|
|
611
|
+
"titleSize": "M",
|
|
599
612
|
"description": "Для людей в возрасте до 75 лет",
|
|
600
613
|
"benefits": [
|
|
601
614
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const AppleIcon = (props?: Record<string, any>) => (
|
|
2
|
+
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<g clip-path="url(#a)">
|
|
4
|
+
<path
|
|
5
|
+
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"
|
|
6
|
+
fill="#42AB44"
|
|
7
|
+
/>
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="a">
|
|
11
|
+
<rect width="24" height="24" rx="6" fill="#fff" />
|
|
12
|
+
</clipPath>
|
|
13
|
+
</defs>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const PlayMarket = (props?: Record<string, any>) => (
|
|
2
|
+
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path
|
|
4
|
+
d="M1 22.427V2.576C1 1.883 1.447 1.284 2.094 1L14.85 12.498 2.089 24a1.89 1.89 0 0 1-.795-.646A1.625 1.625 0 0 1 1 22.427Zm17.899-6.282-13.95 7.259 11.002-9.915 2.948 2.656Zm4.335-5.035c.237.162.428.37.561.61.133.239.203.502.205.77.002.267-.064.53-.193.771s-.317.452-.551.617l-2.964 1.542-3.241-2.922 3.24-2.92 2.944 1.532ZM4.959 1.598l13.938 7.253-2.945 2.654L4.958 1.598Z"
|
|
5
|
+
fill="#42AB44"
|
|
6
|
+
/>
|
|
7
|
+
</svg>
|
|
8
|
+
);
|
package/src/Icons/index.ts
CHANGED
|
@@ -15,3 +15,5 @@ export { ProfileIcon } from './ProfileIcon';
|
|
|
15
15
|
export { SignDocsIcon } from './SignDocsIcon';
|
|
16
16
|
export { TelegramIcon } from './TelegramIcon';
|
|
17
17
|
export { VKIcon } from './VKIcon';
|
|
18
|
+
export { AppleIcon } from './AppleIcon';
|
|
19
|
+
export { PlayMarket } from './PlayMarket';
|
package/src/MobileAppTile.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { Tile } from './Tile';
|
|
3
|
+
import type { BaseTileContent } from './BaseTile';
|
|
3
4
|
import type { UniBlockProps } from './types';
|
|
4
5
|
|
|
5
6
|
export interface QRCode {
|
|
@@ -7,7 +8,7 @@ export interface QRCode {
|
|
|
7
8
|
href?: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export interface MobileAppTileContent {
|
|
11
|
+
export interface MobileAppTileContent extends BaseTileContent {
|
|
11
12
|
title?: string;
|
|
12
13
|
qr?: QRCode;
|
|
13
14
|
}
|
|
@@ -15,9 +16,9 @@ export interface MobileAppTileContent {
|
|
|
15
16
|
export interface MobileAppTileProps extends MobileAppTileContent, UniBlockProps {}
|
|
16
17
|
|
|
17
18
|
export const MobileAppTile = JSX<MobileAppTileProps>(
|
|
18
|
-
({ className, context, title = 'Мобильное приложение', qr }) => {
|
|
19
|
+
({ className, context, title = 'Мобильное приложение', qr, buttons = [] }) => {
|
|
19
20
|
return (
|
|
20
|
-
<Tile className={className} context={context} title={title}>
|
|
21
|
+
<Tile className={className} context={context} title={title} buttons={buttons}>
|
|
21
22
|
<div className="flex items-center">
|
|
22
23
|
{qr?.src && qr?.href && (
|
|
23
24
|
<a href={qr.href} target="_blank">
|
package/src/ProductBlock.tsx
CHANGED
|
@@ -15,7 +15,9 @@ export const ProductBlock = JSX<ProductBlockProps>((props) => {
|
|
|
15
15
|
const router = context.useRouter();
|
|
16
16
|
const { handlerDecorator } = context;
|
|
17
17
|
return (
|
|
18
|
-
<section
|
|
18
|
+
<section
|
|
19
|
+
className={`font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`}
|
|
20
|
+
>
|
|
19
21
|
{breadcrumbs?.length ? (
|
|
20
22
|
<div className="text-xs mb-6">
|
|
21
23
|
{joinList(<span className="text-secondary-text mx-2">/</span>)(
|
|
@@ -16,16 +16,16 @@ export interface ProductBlockInnerProps extends ProductBlockInnerContent, UniBlo
|
|
|
16
16
|
export const ProductBlockInner = JSX<ProductBlockInnerProps>(
|
|
17
17
|
({ className, context, title, description, benefits, buttons, image, items }) => {
|
|
18
18
|
return (
|
|
19
|
-
<div className={`flex justify-between items-stretch ${className || ''}`}>
|
|
19
|
+
<div className={`flex grow justify-between items-stretch ${className || ''}`}>
|
|
20
20
|
<div className={'flex flex-col'}>
|
|
21
21
|
{title && (
|
|
22
|
-
<h1 className="font-medium text-title-lg m-0 whitespace-pre-wrap max-w-[600px]">
|
|
22
|
+
<h1 className="font-medium text-title-lg m-0 mb-4 whitespace-pre-wrap max-w-[600px]">
|
|
23
23
|
{title}
|
|
24
24
|
</h1>
|
|
25
25
|
)}
|
|
26
26
|
<BaseTile context={context} description={description} items={items} buttons={buttons}>
|
|
27
27
|
{benefits?.length ? (
|
|
28
|
-
<div className="flex gap-6 mt-6 mb-
|
|
28
|
+
<div className="flex gap-6 mt-6 mb-3.5">{benefits.map(renderBenefit)}</div>
|
|
29
29
|
) : null}
|
|
30
30
|
</BaseTile>
|
|
31
31
|
</div>
|
package/src/ProductGallery.tsx
CHANGED
|
@@ -54,9 +54,13 @@ export const ProductGallery = JSX<ProductGalleryProps>(
|
|
|
54
54
|
|
|
55
55
|
function renderProductBlock(block: ProductBlockInnerContent, i: number, context) {
|
|
56
56
|
return (
|
|
57
|
-
<section key={String(i)} className="grow-0 shrink-0 basis-full" role="listitem">
|
|
58
|
-
<div className="p-
|
|
59
|
-
<ProductBlockInner
|
|
57
|
+
<section key={String(i)} className="flex grow-0 shrink-0 basis-full" role="listitem">
|
|
58
|
+
<div className="p-10 flex grow">
|
|
59
|
+
<ProductBlockInner
|
|
60
|
+
className="pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem]"
|
|
61
|
+
context={context}
|
|
62
|
+
{...block}
|
|
63
|
+
/>
|
|
60
64
|
</div>
|
|
61
65
|
</section>
|
|
62
66
|
);
|
package/src/ProductTile.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export const ProductTile = JSX<ProductTileProps>((props) => {
|
|
|
14
14
|
const { benefits, version } = props;
|
|
15
15
|
return (
|
|
16
16
|
<Tile {...props}>
|
|
17
|
-
<div className="flex mt-5 mb-
|
|
17
|
+
<div className="flex mt-5 mb-1">
|
|
18
18
|
{benefits?.length ? (
|
|
19
19
|
<div className="mr-8">{benefits.map(renderBenefitDescription)}</div>
|
|
20
20
|
) : null}
|
|
@@ -32,14 +32,14 @@ function renderBenefitLabel(benefit: Benefit, i: number, version = 'primary') {
|
|
|
32
32
|
secondary: 'text-white',
|
|
33
33
|
};
|
|
34
34
|
return (
|
|
35
|
-
<div key={String(i)} className={`text-sm
|
|
35
|
+
<div key={String(i)} className={`text-sm ${i ? 'mt-4' : ''} ${labelStyleMap[version]}`}>
|
|
36
36
|
{benefit.label}
|
|
37
37
|
</div>
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
function renderBenefitDescription(benefit: Benefit, i: number) {
|
|
41
41
|
return (
|
|
42
|
-
<div key={String(i)} className=
|
|
42
|
+
<div key={String(i)} className={`text-xl font-medium ${i ? 'mt-2.5' : ''}`}>
|
|
43
43
|
{benefit.description}
|
|
44
44
|
</div>
|
|
45
45
|
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { BaseTileContent } from './BaseTile';
|
|
3
|
+
import { Tile } from './Tile';
|
|
4
|
+
import type { UniBlockProps } from './types';
|
|
5
|
+
|
|
6
|
+
export interface PromoTileContent extends BaseTileContent {
|
|
7
|
+
date?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PromoTileProps extends PromoTileContent, UniBlockProps {}
|
|
11
|
+
|
|
12
|
+
export const PromoTile = JSX<PromoTileProps>(
|
|
13
|
+
({
|
|
14
|
+
className,
|
|
15
|
+
context,
|
|
16
|
+
title = 'Акции и спецпредложения',
|
|
17
|
+
date,
|
|
18
|
+
description,
|
|
19
|
+
buttons = [],
|
|
20
|
+
version,
|
|
21
|
+
}) => {
|
|
22
|
+
return (
|
|
23
|
+
<Tile
|
|
24
|
+
className={className}
|
|
25
|
+
context={context}
|
|
26
|
+
title={title}
|
|
27
|
+
buttons={buttons}
|
|
28
|
+
version={version}
|
|
29
|
+
>
|
|
30
|
+
<div>
|
|
31
|
+
{date && <div className="text-sm mb-2">{formatDate(date)}</div>}
|
|
32
|
+
<div className="text-base">{description}</div>
|
|
33
|
+
</div>
|
|
34
|
+
</Tile>
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
function formatDate(date: string) {
|
|
40
|
+
const dateObj = new Date(date);
|
|
41
|
+
const dateFormat: Intl.DateTimeFormatOptions = {
|
|
42
|
+
day: 'numeric',
|
|
43
|
+
month: 'long',
|
|
44
|
+
year: 'numeric',
|
|
45
|
+
};
|
|
46
|
+
return dateObj.toLocaleString('ru-RU', dateFormat).replace('г.', '');
|
|
47
|
+
}
|