@redneckz/wildless-cms-uni-blocks 0.2.65 → 0.2.67
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/Header/isSubItemActive.d.ts +1 -1
- package/dist/Header/isSubItemActive.js +2 -4
- package/dist/Header/isSubItemActive.js.map +1 -1
- package/dist/Header/isTopItemActive.d.ts +1 -1
- package/dist/Header/isTopItemActive.js +2 -8
- package/dist/Header/isTopItemActive.js.map +1 -1
- package/dist/MobileBlocks.d.ts +1 -4
- package/dist/MobileBlocks.js +5 -8
- package/dist/MobileBlocks.js.map +1 -1
- package/dist/Placeholder.js +1 -1
- package/dist/Placeholder.js.map +1 -1
- package/dist/ProductBlock.mobile.d.ts +5 -0
- package/dist/ProductBlock.mobile.js +10 -0
- package/dist/ProductBlock.mobile.js.map +1 -0
- package/dist/ProductBlockInner.js +4 -2
- package/dist/ProductBlockInner.js.map +1 -1
- package/dist/useLink.js +1 -1
- package/dist/useLink.js.map +1 -1
- package/dist/utils/url.d.ts +13 -1
- package/dist/utils/url.js +26 -10
- package/dist/utils/url.js.map +1 -1
- package/lib/Header/isSubItemActive.d.ts +1 -1
- package/lib/Header/isSubItemActive.js +3 -5
- package/lib/Header/isSubItemActive.js.map +1 -1
- package/lib/Header/isTopItemActive.d.ts +1 -1
- package/lib/Header/isTopItemActive.js +3 -9
- package/lib/Header/isTopItemActive.js.map +1 -1
- package/lib/MobileBlocks.d.ts +1 -4
- package/lib/MobileBlocks.js +4 -7
- package/lib/MobileBlocks.js.map +1 -1
- package/lib/Placeholder.js +1 -1
- package/lib/Placeholder.js.map +1 -1
- package/lib/ProductBlock.mobile.d.ts +5 -0
- package/lib/ProductBlock.mobile.js +8 -0
- package/lib/ProductBlock.mobile.js.map +1 -0
- package/lib/ProductBlockInner.js +4 -2
- package/lib/ProductBlockInner.js.map +1 -1
- package/lib/useLink.js +2 -2
- package/lib/useLink.js.map +1 -1
- package/lib/utils/url.d.ts +13 -1
- package/lib/utils/url.js +22 -9
- package/lib/utils/url.js.map +1 -1
- package/package.json +1 -1
- package/src/ContentPage.fixture.tsx +2 -2
- package/src/ContentPage.page.json +1 -1
- package/src/Header/isSubItemActive.ts +3 -5
- package/src/Header/isTopItemActive.ts +4 -9
- package/src/MobileBlocks.ts +4 -7
- package/src/Placeholder.tsx +1 -1
- package/src/ProductBlock.mobile.tsx +19 -0
- package/src/ProductBlockInner.tsx +6 -2
- package/src/setup-fixture.ts +12 -0
- package/src/useLink.ts +2 -2
- package/src/utils/url.spec.ts +53 -0
- package/src/utils/url.ts +39 -9
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Router } from '../ContentPageContext';
|
|
2
2
|
import type { LinkContent } from '../types';
|
|
3
|
-
export declare function isSubItemActive(
|
|
3
|
+
export declare function isSubItemActive(router: Router): (subItem: LinkContent) => boolean;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.isSubItemActive = void 0;
|
|
3
3
|
const url_1 = require("../utils/url");
|
|
4
|
-
function isSubItemActive(
|
|
5
|
-
return (
|
|
6
|
-
return (0, url_1.withoutQuery)(item.href) === ((0, url_1.isURL)(item.href) ? (0, url_1.withoutQuery)(href) : pathname);
|
|
7
|
-
};
|
|
4
|
+
function isSubItemActive(router) {
|
|
5
|
+
return (subItem) => (0, url_1.isHrefActive)(subItem.href, router);
|
|
8
6
|
}
|
|
9
7
|
exports.isSubItemActive = isSubItemActive;
|
|
10
8
|
//# sourceMappingURL=isSubItemActive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../src/Header/isSubItemActive.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../src/Header/isSubItemActive.ts"],"names":[],"mappings":";;AAEA,sCAA4C;AAE5C,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAoB,EAAW,EAAE,CAAC,IAAA,kBAAY,EAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/E,CAAC;AAFD,0CAEC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Router } from '../ContentPageContext';
|
|
2
2
|
import type { LinkContent } from '../types';
|
|
3
|
-
export declare function isTopItemActive(
|
|
3
|
+
export declare function isTopItemActive(router: Router): (topItem: LinkContent) => boolean;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.isTopItemActive = void 0;
|
|
3
3
|
const url_1 = require("../utils/url");
|
|
4
|
-
function isTopItemActive(
|
|
5
|
-
return (
|
|
6
|
-
const itemHref = (0, url_1.withoutQuery)(item.href);
|
|
7
|
-
if ((0, url_1.isURL)(itemHref)) {
|
|
8
|
-
return Boolean(href && href.startsWith(itemHref));
|
|
9
|
-
}
|
|
10
|
-
return Boolean(itemHref && pathname.startsWith(itemHref));
|
|
11
|
-
};
|
|
4
|
+
function isTopItemActive(router) {
|
|
5
|
+
return (topItem) => (0, url_1.isHrefActive)(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
|
|
12
6
|
}
|
|
13
7
|
exports.isTopItemActive = isTopItemActive;
|
|
14
8
|
//# sourceMappingURL=isTopItemActive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../src/Header/isTopItemActive.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../src/Header/isTopItemActive.ts"],"names":[],"mappings":";;AAEA,sCAA4C;AAE5C,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAoB,EAAW,EAAE,CACvC,IAAA,kBAAY,EAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AACpG,CAAC;AAHD,0CAGC"}
|
package/dist/MobileBlocks.d.ts
CHANGED
|
@@ -4,11 +4,8 @@ export declare const MobileBlocks: {
|
|
|
4
4
|
Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
|
|
5
5
|
Tile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Tile").TileProps, any>, context?: any) => any;
|
|
6
6
|
ProductTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductTile").ProductTileProps, any>, context?: any) => any;
|
|
7
|
-
ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductBlock").ProductBlockProps, any>, context?: any) => any;
|
|
8
|
-
StepsBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./StepsBlock").StepsBlockProps, any>, context?: any) => any;
|
|
7
|
+
ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductBlock.mobile").ProductBlockProps, any>, context?: any) => any;
|
|
9
8
|
TextBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextBlock").TextBlockProps, any>, context?: any) => any;
|
|
10
|
-
BenefitsBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./BenefitsBlock").BenefitsBlockProps, any>, context?: any) => any;
|
|
11
|
-
ProductGallery: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductGallery").ProductGalleryProps, any>, context?: any) => any;
|
|
12
9
|
ExchangeRateTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ExchangeRateTile").ExchangeRateTileProps, any>, context?: any) => any;
|
|
13
10
|
MobileAppTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./MobileAppTile").MobileAppTileProps, any>, context?: any) => any;
|
|
14
11
|
};
|
package/dist/MobileBlocks.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.MobileBlocks = void 0;
|
|
3
|
-
const BenefitsBlock_1 = require("./BenefitsBlock");
|
|
4
3
|
const ExchangeRateTile_1 = require("./ExchangeRateTile");
|
|
5
4
|
const Footer_mobile_1 = require("./Footer/Footer.mobile");
|
|
6
5
|
const index_1 = require("./Header/index");
|
|
7
6
|
const MobileAppTile_1 = require("./MobileAppTile");
|
|
8
7
|
const Placeholder_1 = require("./Placeholder");
|
|
9
|
-
const
|
|
10
|
-
const ProductGallery_1 = require("./ProductGallery");
|
|
8
|
+
const ProductBlock_mobile_1 = require("./ProductBlock.mobile");
|
|
11
9
|
const ProductTile_1 = require("./ProductTile");
|
|
12
|
-
const StepsBlock_1 = require("./StepsBlock");
|
|
13
10
|
const TextBlock_1 = require("./TextBlock");
|
|
14
11
|
const Tile_1 = require("./Tile");
|
|
15
12
|
exports.MobileBlocks = {
|
|
@@ -18,12 +15,12 @@ exports.MobileBlocks = {
|
|
|
18
15
|
Placeholder: Placeholder_1.Placeholder,
|
|
19
16
|
Tile: Tile_1.Tile,
|
|
20
17
|
ProductTile: ProductTile_1.ProductTile,
|
|
21
|
-
ProductBlock:
|
|
22
|
-
StepsBlock: StepsBlock_1.StepsBlock,
|
|
18
|
+
ProductBlock: ProductBlock_mobile_1.ProductBlock,
|
|
23
19
|
TextBlock: TextBlock_1.TextBlock,
|
|
24
|
-
BenefitsBlock: BenefitsBlock_1.BenefitsBlock,
|
|
25
|
-
ProductGallery: ProductGallery_1.ProductGallery,
|
|
26
20
|
ExchangeRateTile: ExchangeRateTile_1.ExchangeRateTile,
|
|
27
21
|
MobileAppTile: MobileAppTile_1.MobileAppTile,
|
|
22
|
+
// TODO StepsBlock,
|
|
23
|
+
// TODO BenefitsBlock,
|
|
24
|
+
// TODO ProductGallery
|
|
28
25
|
};
|
|
29
26
|
//# sourceMappingURL=MobileBlocks.js.map
|
package/dist/MobileBlocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBlocks.js","sourceRoot":"","sources":["../src/MobileBlocks.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"MobileBlocks.js","sourceRoot":"","sources":["../src/MobileBlocks.ts"],"names":[],"mappings":";;AAAA,yDAAsD;AACtD,0DAAgD;AAChD,0CAAwC;AACxC,mDAAgD;AAChD,+CAA4C;AAC5C,+DAAqD;AACrD,+CAA4C;AAC5C,2CAAwC;AACxC,iCAA8B;AAEjB,QAAA,YAAY,GAAG;IAC1B,MAAM,EAAN,cAAM;IACN,MAAM,EAAN,sBAAM;IACN,WAAW,EAAX,yBAAW;IACX,IAAI,EAAJ,WAAI;IACJ,WAAW,EAAX,yBAAW;IACX,YAAY,EAAZ,kCAAY;IACZ,SAAS,EAAT,qBAAS;IACT,gBAAgB,EAAhB,mCAAgB;IAChB,aAAa,EAAb,6BAAa;IACb,mBAAmB;IACnB,sBAAsB;IACtB,sBAAsB;CACvB,CAAC"}
|
package/dist/Placeholder.js
CHANGED
|
@@ -5,7 +5,7 @@ const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
|
5
5
|
const Tile_1 = require("./Tile");
|
|
6
6
|
const GOLDEN_RATIO = 1.618;
|
|
7
7
|
exports.Placeholder = (0, uni_jsx_1.JSX)(({ className, context, title }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(Tile_1.Tile, { className: className, context: context, title: title, children: (0, jsx_runtime_1.jsx)("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(Tile_1.Tile, { className: className, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: (0, jsx_runtime_1.jsx)("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
|
|
9
9
|
});
|
|
10
10
|
const renderShimmer = (size = 3) => goldenSequence(100, size)
|
|
11
11
|
.map((_) => Math.floor(_))
|
package/dist/Placeholder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,iCAA8B;AAW9B,MAAM,YAAY,GAAG,KAAK,CAAC;AAEd,QAAA,WAAW,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,uBAAC,WAAI,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,iCAA8B;AAW9B,MAAM,YAAY,GAAG,KAAK,CAAC;AAEd,QAAA,WAAW,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,uBAAC,WAAI,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAC,iGAAsB,YAC5F,mCAAQ,SAAS,EAAC,mBAAmB,YAAE,aAAa,EAAE,GAAU,GAC3D,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,OAAe,CAAC,EAAE,EAAE,CACzC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC;KACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACzB,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAE5B,MAAM,iBAAiB,GAAG,CAAC,QAAgB,GAAG,EAAE,KAAa,EAAE,EAAE,CAAC,CAChE,gCAAyB,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,EAAE,SAAS,EAAC,6BAA6B,IAArF,MAAM,CAAC,KAAK,CAAC,CAA2E,CACnG,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,IAAY,EAAY,EAAE,CAC/D,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,GAAG,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProductBlockInnerContent } from './ProductBlockInner';
|
|
2
|
+
import type { UniBlockProps } from './types';
|
|
3
|
+
export interface ProductBlockProps extends ProductBlockInnerContent, UniBlockProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<ProductBlockProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ProductBlock = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const ProductBlockInner_1 = require("./ProductBlockInner");
|
|
6
|
+
exports.ProductBlock = (0, uni_jsx_1.JSX)(({ titleSize, image, benefits, ...props } /* Get rid of image and benefits */) => {
|
|
7
|
+
const { className } = props;
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("section", { className: `font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`, children: (0, jsx_runtime_1.jsx)(ProductBlockInner_1.ProductBlockInner, { ...props, titleSize: "L" }) }));
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=ProductBlock.mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductBlock.mobile.js","sourceRoot":"","sources":["../src/ProductBlock.mobile.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,2DAAwD;AAK3C,QAAA,YAAY,GAAG,IAAA,aAAG,EAC7B,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC,mCAAmC,EAAE,EAAE;IAC/E,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,OAAO,CACL,oCACE,SAAS,EAAE,4DAA4D,SAAS,IAAI,EAAE,EAAE,YAExF,uBAAC,qCAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,GAAG,GAAG,GACtC,CACX,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -6,8 +6,10 @@ const BaseTile_1 = require("./BaseTile");
|
|
|
6
6
|
const Img_1 = require("./Img");
|
|
7
7
|
const Icon_1 = require("./ui-kit/Icon");
|
|
8
8
|
const Title_1 = require("./ui-kit/Title");
|
|
9
|
-
exports.ProductBlockInner = (0, uni_jsx_1.JSX)(({ className, context, title, description, benefits, buttons, image, items }) => {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-col', children: [title && (
|
|
9
|
+
exports.ProductBlockInner = (0, uni_jsx_1.JSX)(({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-col', children: [title && (
|
|
11
|
+
/* TODO Why <Title> is duplicated here? */
|
|
12
|
+
(0, jsx_runtime_1.jsx)(Title_1.Title, { size: titleSize || 'XL', className: "font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]", children: title })), (0, jsx_runtime_1.jsx)(BaseTile_1.BaseTile, { context: context, description: description, items: items, buttons: buttons, children: benefits?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "flex gap-6 mt-6 mb-3.5", children: benefits.map(renderBenefit) })) : null })] }), image?.src && (0, jsx_runtime_1.jsx)(Img_1.Img, { className: "mt-auto", image: image })] }));
|
|
11
13
|
});
|
|
12
14
|
function renderBenefit(benefit, i) {
|
|
13
15
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-center", children: [benefit.icon && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { className: "w-[50px] h-[50px] min-w-[50px] min-h-[50px] bg-main rounded-full p-[10px] box-border", name: benefit.icon, width: "24", height: "24" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 flex-col h-full", children: [(0, jsx_runtime_1.jsx)("h4", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && ((0, jsx_runtime_1.jsx)("div", { className: "font-normal text-sm text-secondary-text", children: benefit.description }))] })] }, String(i)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductBlockInner.js","sourceRoot":"","sources":["../src/ProductBlockInner.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,yCAAsC;AAEtC,+BAA4B;AAE5B,wCAAqC;AACrC,0CAAuC;AAQ1B,QAAA,iBAAiB,GAAG,IAAA,aAAG,EAClC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"ProductBlockInner.js","sourceRoot":"","sources":["../src/ProductBlockInner.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,yCAAsC;AAEtC,+BAA4B;AAE5B,wCAAqC;AACrC,0CAAuC;AAQ1B,QAAA,iBAAiB,GAAG,IAAA,aAAG,EAClC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,E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AACJ,CAAC"}
|
package/dist/useLink.js
CHANGED
|
@@ -3,7 +3,7 @@ exports.useLink = void 0;
|
|
|
3
3
|
const url_1 = require("./utils/url");
|
|
4
4
|
const defaultHandlerDecorator = (handler, targetContent) => handler;
|
|
5
5
|
function useLink({ router, handlerDecorator = defaultHandlerDecorator, }, link) {
|
|
6
|
-
const href = (0, url_1.
|
|
6
|
+
const href = (0, url_1.adjustHref)(link.href, router);
|
|
7
7
|
return {
|
|
8
8
|
...link,
|
|
9
9
|
href,
|
package/dist/useLink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":";;AAEA,qCAAgD;AAEhD,MAAM,uBAAuB,GAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC;AAEtF,SAAgB,OAAO,CACrB,EACE,MAAM,EACN,gBAAgB,GAAG,uBAAuB,GACc,EAC1D,IAA0B;IAE1B,MAAM,IAAI,GAAG,IAAA,gBAAU,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,GAAG,IAAI;QACP,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,IAAI;QACpB,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAc,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,IAAA,WAAK,EAAC,IAAI,CAAC,CAAC;YACzC,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;YAC9D,IAAI,WAAW,IAAI,aAAa,EAAE;gBAChC,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,EAAE,IAAI,CAAC;KACT,CAAC;AACJ,CAAC;AArBD,0BAqBC"}
|
package/dist/utils/url.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export declare const MOBILE_URL_PATH = "/mobile";
|
|
1
2
|
export declare const isURL: (href?: string) => boolean | undefined;
|
|
3
|
+
export declare const isHrefActive: (href: string | undefined, router: {
|
|
4
|
+
pathname?: string | undefined;
|
|
5
|
+
href?: string | undefined;
|
|
6
|
+
}, cmp?: (href: string, baseHref: string) => boolean) => boolean;
|
|
2
7
|
export declare const withoutQuery: (href?: string) => string;
|
|
8
|
+
export declare const withoutMobilePath: (href?: string) => string;
|
|
3
9
|
export declare const getOrigin: (href?: string) => string | undefined;
|
|
4
|
-
export declare const
|
|
10
|
+
export declare const adjustHref: (href: string | undefined, router: {
|
|
11
|
+
pathname: string;
|
|
12
|
+
href?: string | undefined;
|
|
13
|
+
}) => string | undefined;
|
|
14
|
+
export declare const toRelativeHref: (href: string | undefined, router: {
|
|
15
|
+
href?: string | undefined;
|
|
16
|
+
}) => string | undefined;
|
package/dist/utils/url.js
CHANGED
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.toRelativeHref = exports.getOrigin = exports.withoutQuery = exports.isURL = void 0;
|
|
2
|
+
exports.toRelativeHref = exports.adjustHref = exports.getOrigin = exports.withoutMobilePath = exports.withoutQuery = exports.isHrefActive = exports.isURL = exports.MOBILE_URL_PATH = void 0;
|
|
3
|
+
exports.MOBILE_URL_PATH = '/mobile';
|
|
3
4
|
const isURL = (href) => href?.includes('//');
|
|
4
5
|
exports.isURL = isURL;
|
|
6
|
+
const isHrefActive = (href, router, cmp = (href, baseHref) => href === baseHref) => {
|
|
7
|
+
return cmp((0, exports.withoutQuery)(href), (0, exports.withoutMobilePath)((0, exports.withoutQuery)((0, exports.isURL)(href) ? router.href : router.pathname)));
|
|
8
|
+
};
|
|
9
|
+
exports.isHrefActive = isHrefActive;
|
|
5
10
|
const withoutQuery = (href) => (href || '').replace(/\/?\?.*/, '');
|
|
6
11
|
exports.withoutQuery = withoutQuery;
|
|
12
|
+
const withoutMobilePath = (href) => (href || '').replace(exports.MOBILE_URL_PATH, '');
|
|
13
|
+
exports.withoutMobilePath = withoutMobilePath;
|
|
7
14
|
const getOrigin = (href) => {
|
|
8
|
-
if ((0, exports.isURL)(href)) {
|
|
9
|
-
|
|
10
|
-
const protoSeparator = '://';
|
|
11
|
-
const endOfProto = url.indexOf(protoSeparator);
|
|
12
|
-
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
13
|
-
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
15
|
+
if (!(0, exports.isURL)(href)) {
|
|
16
|
+
return undefined;
|
|
14
17
|
}
|
|
15
|
-
|
|
18
|
+
const url = href;
|
|
19
|
+
const protoSeparator = '//';
|
|
20
|
+
const endOfProto = url.indexOf(protoSeparator);
|
|
21
|
+
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
22
|
+
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
16
23
|
};
|
|
17
24
|
exports.getOrigin = getOrigin;
|
|
18
|
-
const
|
|
25
|
+
const adjustHref = (href, router) => {
|
|
26
|
+
if (!href) {
|
|
27
|
+
return href;
|
|
28
|
+
}
|
|
29
|
+
const relativeHref = (0, exports.toRelativeHref)(href, router);
|
|
30
|
+
const isMobilePage = router?.pathname.startsWith(exports.MOBILE_URL_PATH);
|
|
31
|
+
return isMobilePage && !(0, exports.isURL)(relativeHref) ? `${exports.MOBILE_URL_PATH}${relativeHref}` : relativeHref;
|
|
32
|
+
};
|
|
33
|
+
exports.adjustHref = adjustHref;
|
|
34
|
+
const toRelativeHref = (href, router) => {
|
|
19
35
|
if (!href) {
|
|
20
36
|
return href;
|
|
21
37
|
}
|
|
22
|
-
const origin = (0, exports.getOrigin)(
|
|
38
|
+
const origin = (0, exports.getOrigin)(router?.href);
|
|
23
39
|
return origin ? href.replace(origin, '') || '/' : href;
|
|
24
40
|
};
|
|
25
41
|
exports.toRelativeHref = toRelativeHref;
|
package/dist/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":";;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC;AAElC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAAhD,QAAA,KAAK,SAA2C;AAEtD,MAAM,YAAY,GAAG,CAC1B,IAAwB,EACxB,MAA4C,EAC5C,MAAmD,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,EACxF,EAAE;IACF,OAAO,GAAG,CACR,IAAA,oBAAY,EAAC,IAAI,CAAC,EAClB,IAAA,yBAAiB,EAAC,IAAA,oBAAY,EAAC,IAAA,aAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,YAAY,gBASvB;AAEK,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAAtE,QAAA,YAAY,gBAA0D;AAE5E,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAe,EAAE,EAAE,CAAC,CAAC;AAAjF,QAAA,iBAAiB,qBAAgE;AAEvF,MAAM,SAAS,GAAG,CAAC,IAAa,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E,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Router } from '../ContentPageContext';
|
|
2
2
|
import type { LinkContent } from '../types';
|
|
3
|
-
export declare function isSubItemActive(
|
|
3
|
+
export declare function isSubItemActive(router: Router): (subItem: LinkContent) => boolean;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function isSubItemActive(
|
|
3
|
-
return (
|
|
4
|
-
return withoutQuery(item.href) === (isURL(item.href) ? withoutQuery(href) : pathname);
|
|
5
|
-
};
|
|
1
|
+
import { isHrefActive } from '../utils/url.js';
|
|
2
|
+
export function isSubItemActive(router) {
|
|
3
|
+
return (subItem) => isHrefActive(subItem.href, router);
|
|
6
4
|
}
|
|
7
5
|
//# sourceMappingURL=isSubItemActive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../src/Header/isSubItemActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../src/Header/isSubItemActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAoB,EAAW,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Router } from '../ContentPageContext';
|
|
2
2
|
import type { LinkContent } from '../types';
|
|
3
|
-
export declare function isTopItemActive(
|
|
3
|
+
export declare function isTopItemActive(router: Router): (topItem: LinkContent) => boolean;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function isTopItemActive(
|
|
3
|
-
return (
|
|
4
|
-
const itemHref = withoutQuery(item.href);
|
|
5
|
-
if (isURL(itemHref)) {
|
|
6
|
-
return Boolean(href && href.startsWith(itemHref));
|
|
7
|
-
}
|
|
8
|
-
return Boolean(itemHref && pathname.startsWith(itemHref));
|
|
9
|
-
};
|
|
1
|
+
import { isHrefActive } from '../utils/url.js';
|
|
2
|
+
export function isTopItemActive(router) {
|
|
3
|
+
return (topItem) => isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
|
|
10
4
|
}
|
|
11
5
|
//# sourceMappingURL=isTopItemActive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../src/Header/isTopItemActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../src/Header/isTopItemActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAoB,EAAW,EAAE,CACvC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AACpG,CAAC"}
|
package/lib/MobileBlocks.d.ts
CHANGED
|
@@ -4,11 +4,8 @@ export declare const MobileBlocks: {
|
|
|
4
4
|
Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
|
|
5
5
|
Tile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Tile").TileProps, any>, context?: any) => any;
|
|
6
6
|
ProductTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductTile").ProductTileProps, any>, context?: any) => any;
|
|
7
|
-
ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductBlock").ProductBlockProps, any>, context?: any) => any;
|
|
8
|
-
StepsBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./StepsBlock").StepsBlockProps, any>, context?: any) => any;
|
|
7
|
+
ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductBlock.mobile").ProductBlockProps, any>, context?: any) => any;
|
|
9
8
|
TextBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextBlock").TextBlockProps, any>, context?: any) => any;
|
|
10
|
-
BenefitsBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./BenefitsBlock").BenefitsBlockProps, any>, context?: any) => any;
|
|
11
|
-
ProductGallery: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductGallery").ProductGalleryProps, any>, context?: any) => any;
|
|
12
9
|
ExchangeRateTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ExchangeRateTile").ExchangeRateTileProps, any>, context?: any) => any;
|
|
13
10
|
MobileAppTile: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./MobileAppTile").MobileAppTileProps, any>, context?: any) => any;
|
|
14
11
|
};
|
package/lib/MobileBlocks.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { BenefitsBlock } from './BenefitsBlock.js';
|
|
2
1
|
import { ExchangeRateTile } from './ExchangeRateTile.js';
|
|
3
2
|
import { Footer } from './Footer/Footer.mobile.js';
|
|
4
3
|
import { Header } from './Header/index.js';
|
|
5
4
|
import { MobileAppTile } from './MobileAppTile.js';
|
|
6
5
|
import { Placeholder } from './Placeholder.js';
|
|
7
|
-
import { ProductBlock } from './ProductBlock.js';
|
|
8
|
-
import { ProductGallery } from './ProductGallery.js';
|
|
6
|
+
import { ProductBlock } from './ProductBlock.mobile.js';
|
|
9
7
|
import { ProductTile } from './ProductTile.js';
|
|
10
|
-
import { StepsBlock } from './StepsBlock.js';
|
|
11
8
|
import { TextBlock } from './TextBlock.js';
|
|
12
9
|
import { Tile } from './Tile.js';
|
|
13
10
|
export const MobileBlocks = {
|
|
@@ -17,11 +14,11 @@ export const MobileBlocks = {
|
|
|
17
14
|
Tile,
|
|
18
15
|
ProductTile,
|
|
19
16
|
ProductBlock,
|
|
20
|
-
StepsBlock,
|
|
21
17
|
TextBlock,
|
|
22
|
-
BenefitsBlock,
|
|
23
|
-
ProductGallery,
|
|
24
18
|
ExchangeRateTile,
|
|
25
19
|
MobileAppTile,
|
|
20
|
+
// TODO StepsBlock,
|
|
21
|
+
// TODO BenefitsBlock,
|
|
22
|
+
// TODO ProductGallery
|
|
26
23
|
};
|
|
27
24
|
//# sourceMappingURL=MobileBlocks.js.map
|
package/lib/MobileBlocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBlocks.js","sourceRoot":"","sources":["../src/MobileBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"MobileBlocks.js","sourceRoot":"","sources":["../src/MobileBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,MAAM;IACN,WAAW;IACX,IAAI;IACJ,WAAW;IACX,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,mBAAmB;IACnB,sBAAsB;IACtB,sBAAsB;CACvB,CAAC"}
|
package/lib/Placeholder.js
CHANGED
|
@@ -3,7 +3,7 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
3
3
|
import { Tile } from './Tile.js';
|
|
4
4
|
const GOLDEN_RATIO = 1.618;
|
|
5
5
|
export const Placeholder = JSX(({ className, context, title }) => {
|
|
6
|
-
return (_jsx(Tile, { className: className, context: context, title: title, children: _jsx("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
|
|
6
|
+
return (_jsx(Tile, { className: className, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: _jsx("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
|
|
7
7
|
});
|
|
8
8
|
const renderShimmer = (size = 3) => goldenSequence(100, size)
|
|
9
9
|
.map((_) => Math.floor(_))
|
package/lib/Placeholder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAW9B,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAmB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,KAAC,IAAI,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAA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+
export interface ProductBlockProps extends ProductBlockInnerContent, UniBlockProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<ProductBlockProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { ProductBlockInner } from './ProductBlockInner.js';
|
|
4
|
+
export const ProductBlock = JSX(({ titleSize, image, benefits, ...props } /* Get rid of image and benefits */) => {
|
|
5
|
+
const { className } = props;
|
|
6
|
+
return (_jsx("section", { className: `font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`, children: _jsx(ProductBlockInner, { ...props, titleSize: "L" }) }));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=ProductBlock.mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductBlock.mobile.js","sourceRoot":"","sources":["../src/ProductBlock.mobile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAC7B,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC,mCAAmC,EAAE,EAAE;IAC/E,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,OAAO,CACL,kBACE,SAAS,EAAE,4DAA4D,SAAS,IAAI,EAAE,EAAE,YAExF,KAAC,iBAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,GAAG,GAAG,GACtC,CACX,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/lib/ProductBlockInner.js
CHANGED
|
@@ -4,8 +4,10 @@ import { BaseTile } from './BaseTile.js';
|
|
|
4
4
|
import { Img } from './Img.js';
|
|
5
5
|
import { Icon } from './ui-kit/Icon.js';
|
|
6
6
|
import { Title } from './ui-kit/Title.js';
|
|
7
|
-
export const ProductBlockInner = JSX(({ className, context, title, description, benefits, buttons, image, items }) => {
|
|
8
|
-
return (_jsxs("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [_jsxs("div", { className: 'flex flex-col', children: [title && (
|
|
7
|
+
export const ProductBlockInner = JSX(({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
|
|
8
|
+
return (_jsxs("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [_jsxs("div", { className: 'flex flex-col', children: [title && (
|
|
9
|
+
/* TODO Why <Title> is duplicated here? */
|
|
10
|
+
_jsx(Title, { size: titleSize || 'XL', className: "font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]", children: title })), _jsx(BaseTile, { context: context, description: description, items: items, buttons: buttons, children: benefits?.length ? (_jsx("div", { className: "flex gap-6 mt-6 mb-3.5", children: benefits.map(renderBenefit) })) : null })] }), image?.src && _jsx(Img, { className: "mt-auto", image: image })] }));
|
|
9
11
|
});
|
|
10
12
|
function renderBenefit(benefit, i) {
|
|
11
13
|
return (_jsxs("div", { className: "flex gap-4 items-center", children: [benefit.icon && (_jsx(Icon, { className: "w-[50px] h-[50px] min-w-[50px] min-h-[50px] bg-main rounded-full p-[10px] box-border", name: benefit.icon, width: "24", height: "24" })), _jsxs("div", { className: "flex gap-1 flex-col h-full", children: [_jsx("h4", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && (_jsx("div", { className: "font-normal text-sm text-secondary-text", children: benefit.description }))] })] }, String(i)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductBlockInner.js","sourceRoot":"","sources":["../src/ProductBlockInner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,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C,CAAC,CAAC,CAClB,cAAK,SAAS,EAAC,wBAAwB,YAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,GAAO,CAC5E,CAAC,CAAC,CAAC,IAAI,GACC,IACP,EACL,KAAK,EAAE,GAAG,IAAI,KAAC,GAAG,IAAC,SAAS,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,GAAI,IACpD,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,aAAa,CAAC,OAAgB,EAAE,CAAS;IAChD,OAAO,CACL,eAAqB,SAAS,EAAC,yBAAyB,aACrD,OAAO,CAAC,IAAI,IAAI,CACf,KAAC,IAAI,IACH,SAAS,EAAC,sFAAsF,EAChG,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,GACX,CACH,EACD,eAAK,SAAS,EAAC,4BAA4B,aACzC,aAAI,SAAS,EAAC,yBAAyB,YAAE,OAAO,CAAC,KAAK,GAAM,EAC3D,OAAO,CAAC,WAAW,IAAI,CACtB,cAAK,SAAS,EAAC,yCAAyC,YAAE,OAAO,CAAC,WAAW,GAAO,CACrF,IACG,KAdE,MAAM,CAAC,CAAC,CAAC,CAeb,CACP,CAAC;AACJ,CAAC"}
|
package/lib/useLink.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { adjustHref, isURL } from './utils/url.js';
|
|
2
2
|
const defaultHandlerDecorator = (handler, targetContent) => handler;
|
|
3
3
|
export function useLink({ router, handlerDecorator = defaultHandlerDecorator, }, link) {
|
|
4
|
-
const href =
|
|
4
|
+
const href = adjustHref(link.href, router);
|
|
5
5
|
return {
|
|
6
6
|
...link,
|
|
7
7
|
href,
|
package/lib/useLink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,uBAAuB,GAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC;AAEtF,MAAM,UAAU,OAAO,CACrB,EACE,MAAM,EACN,gBAAgB,GAAG,uBAAuB,GACc,EAC1D,IAA0B;IAE1B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,GAAG,IAAI;QACP,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,IAAI;QACpB,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAc,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;YAC9D,IAAI,WAAW,IAAI,aAAa,EAAE;gBAChC,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,EAAE,IAAI,CAAC;KACT,CAAC;AACJ,CAAC"}
|
package/lib/utils/url.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export declare const MOBILE_URL_PATH = "/mobile";
|
|
1
2
|
export declare const isURL: (href?: string) => boolean | undefined;
|
|
3
|
+
export declare const isHrefActive: (href: string | undefined, router: {
|
|
4
|
+
pathname?: string | undefined;
|
|
5
|
+
href?: string | undefined;
|
|
6
|
+
}, cmp?: (href: string, baseHref: string) => boolean) => boolean;
|
|
2
7
|
export declare const withoutQuery: (href?: string) => string;
|
|
8
|
+
export declare const withoutMobilePath: (href?: string) => string;
|
|
3
9
|
export declare const getOrigin: (href?: string) => string | undefined;
|
|
4
|
-
export declare const
|
|
10
|
+
export declare const adjustHref: (href: string | undefined, router: {
|
|
11
|
+
pathname: string;
|
|
12
|
+
href?: string | undefined;
|
|
13
|
+
}) => string | undefined;
|
|
14
|
+
export declare const toRelativeHref: (href: string | undefined, router: {
|
|
15
|
+
href?: string | undefined;
|
|
16
|
+
}) => string | undefined;
|
package/lib/utils/url.js
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
+
export const MOBILE_URL_PATH = '/mobile';
|
|
1
2
|
export const isURL = (href) => href?.includes('//');
|
|
3
|
+
export const isHrefActive = (href, router, cmp = (href, baseHref) => href === baseHref) => {
|
|
4
|
+
return cmp(withoutQuery(href), withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)));
|
|
5
|
+
};
|
|
2
6
|
export const withoutQuery = (href) => (href || '').replace(/\/?\?.*/, '');
|
|
7
|
+
export const withoutMobilePath = (href) => (href || '').replace(MOBILE_URL_PATH, '');
|
|
3
8
|
export const getOrigin = (href) => {
|
|
4
|
-
if (isURL(href)) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
if (!isURL(href)) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const url = href;
|
|
13
|
+
const protoSeparator = '//';
|
|
14
|
+
const endOfProto = url.indexOf(protoSeparator);
|
|
15
|
+
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
16
|
+
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
17
|
+
};
|
|
18
|
+
export const adjustHref = (href, router) => {
|
|
19
|
+
if (!href) {
|
|
20
|
+
return href;
|
|
10
21
|
}
|
|
11
|
-
|
|
22
|
+
const relativeHref = toRelativeHref(href, router);
|
|
23
|
+
const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
|
|
24
|
+
return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
|
|
12
25
|
};
|
|
13
|
-
export const toRelativeHref = (href,
|
|
26
|
+
export const toRelativeHref = (href, router) => {
|
|
14
27
|
if (!href) {
|
|
15
28
|
return href;
|
|
16
29
|
}
|
|
17
|
-
const origin = getOrigin(
|
|
30
|
+
const origin = getOrigin(router?.href);
|
|
18
31
|
return origin ? href.replace(origin, '') || '/' : href;
|
|
19
32
|
};
|
|
20
33
|
//# sourceMappingURL=url.js.map
|
package/lib/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAwB,EACxB,MAA4C,EAC5C,MAAmD,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,EACxF,EAAE;IACF,OAAO,GAAG,CACR,YAAY,CAAC,IAAI,CAAC,EAClB,iBAAiB,CAAC,YAAY,CAAC,KAAK,C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C;IAClE,OAAO,YAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,GAAG,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAwB,EAAE,MAAyB,EAAE,EAAE;IACpF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { context } from './setup-fixture';
|
|
1
|
+
import { context, mobileContext } from './setup-fixture';
|
|
2
2
|
|
|
3
3
|
import { Blocks } from './Blocks';
|
|
4
4
|
import { BlockDecorator, ContentPage } from './ContentPage';
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
mobile: (
|
|
40
40
|
<ContentPage
|
|
41
41
|
className="bg-secondary-text"
|
|
42
|
-
context={
|
|
42
|
+
context={mobileContext}
|
|
43
43
|
blocksRegistry={MobileBlocks}
|
|
44
44
|
data={toMobilePage(data as ContentPageDef)}
|
|
45
45
|
/>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Router } from '../ContentPageContext';
|
|
2
2
|
import type { LinkContent } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import { isHrefActive } from '../utils/url';
|
|
4
4
|
|
|
5
|
-
export function isSubItemActive(
|
|
6
|
-
return (
|
|
7
|
-
return withoutQuery(item.href) === (isURL(item.href) ? withoutQuery(href) : pathname);
|
|
8
|
-
};
|
|
5
|
+
export function isSubItemActive(router: Router) {
|
|
6
|
+
return (subItem: LinkContent): boolean => isHrefActive(subItem.href, router);
|
|
9
7
|
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { Router } from '../ContentPageContext';
|
|
2
2
|
import type { LinkContent } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import { isHrefActive } from '../utils/url';
|
|
4
4
|
|
|
5
|
-
export function isTopItemActive(
|
|
6
|
-
return (
|
|
7
|
-
|
|
8
|
-
if (isURL(itemHref)) {
|
|
9
|
-
return Boolean(href && href.startsWith(itemHref));
|
|
10
|
-
}
|
|
11
|
-
return Boolean(itemHref && pathname.startsWith(itemHref));
|
|
12
|
-
};
|
|
5
|
+
export function isTopItemActive(router: Router) {
|
|
6
|
+
return (topItem: LinkContent): boolean =>
|
|
7
|
+
isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
|
|
13
8
|
}
|
package/src/MobileBlocks.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { BenefitsBlock } from './BenefitsBlock';
|
|
2
1
|
import { ExchangeRateTile } from './ExchangeRateTile';
|
|
3
2
|
import { Footer } from './Footer/Footer.mobile';
|
|
4
3
|
import { Header } from './Header/index';
|
|
5
4
|
import { MobileAppTile } from './MobileAppTile';
|
|
6
5
|
import { Placeholder } from './Placeholder';
|
|
7
|
-
import { ProductBlock } from './ProductBlock';
|
|
8
|
-
import { ProductGallery } from './ProductGallery';
|
|
6
|
+
import { ProductBlock } from './ProductBlock.mobile';
|
|
9
7
|
import { ProductTile } from './ProductTile';
|
|
10
|
-
import { StepsBlock } from './StepsBlock';
|
|
11
8
|
import { TextBlock } from './TextBlock';
|
|
12
9
|
import { Tile } from './Tile';
|
|
13
10
|
|
|
@@ -18,10 +15,10 @@ export const MobileBlocks = {
|
|
|
18
15
|
Tile,
|
|
19
16
|
ProductTile,
|
|
20
17
|
ProductBlock,
|
|
21
|
-
StepsBlock,
|
|
22
18
|
TextBlock,
|
|
23
|
-
BenefitsBlock,
|
|
24
|
-
ProductGallery,
|
|
25
19
|
ExchangeRateTile,
|
|
26
20
|
MobileAppTile,
|
|
21
|
+
// TODO StepsBlock,
|
|
22
|
+
// TODO BenefitsBlock,
|
|
23
|
+
// TODO ProductGallery
|
|
27
24
|
};
|
package/src/Placeholder.tsx
CHANGED
|
@@ -14,7 +14,7 @@ const GOLDEN_RATIO = 1.618;
|
|
|
14
14
|
|
|
15
15
|
export const Placeholder = JSX<PlaceholderProps>(({ className, context, title }) => {
|
|
16
16
|
return (
|
|
17
|
-
<Tile className={className} context={context} title={title}>
|
|
17
|
+
<Tile className={className} context={context} title={title} description="Блок в разработке...">
|
|
18
18
|
<figure className="m-0 min-w-[600px]">{renderShimmer()}</figure>
|
|
19
19
|
</Tile>
|
|
20
20
|
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { ProductBlockInnerContent } from './ProductBlockInner';
|
|
3
|
+
import { ProductBlockInner } from './ProductBlockInner';
|
|
4
|
+
import type { UniBlockProps } from './types';
|
|
5
|
+
|
|
6
|
+
export interface ProductBlockProps extends ProductBlockInnerContent, UniBlockProps {}
|
|
7
|
+
|
|
8
|
+
export const ProductBlock = JSX<ProductBlockProps>(
|
|
9
|
+
({ titleSize, image, benefits, ...props } /* Get rid of image and benefits */) => {
|
|
10
|
+
const { className } = props;
|
|
11
|
+
return (
|
|
12
|
+
<section
|
|
13
|
+
className={`font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`}
|
|
14
|
+
>
|
|
15
|
+
<ProductBlockInner {...props} titleSize="L" />
|
|
16
|
+
</section>
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
);
|
|
@@ -14,12 +14,16 @@ export interface ProductBlockInnerContent extends BaseTileContent {
|
|
|
14
14
|
export interface ProductBlockInnerProps extends ProductBlockInnerContent, UniBlockProps {}
|
|
15
15
|
|
|
16
16
|
export const ProductBlockInner = JSX<ProductBlockInnerProps>(
|
|
17
|
-
({ className, context, title, description, benefits, buttons, image, items }) => {
|
|
17
|
+
({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
|
|
18
18
|
return (
|
|
19
19
|
<div className={`flex grow justify-between items-stretch ${className || ''}`}>
|
|
20
20
|
<div className={'flex flex-col'}>
|
|
21
21
|
{title && (
|
|
22
|
-
|
|
22
|
+
/* TODO Why <Title> is duplicated here? */
|
|
23
|
+
<Title
|
|
24
|
+
size={titleSize || 'XL'}
|
|
25
|
+
className="font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]"
|
|
26
|
+
>
|
|
23
27
|
{title}
|
|
24
28
|
</Title>
|
|
25
29
|
)}
|
package/src/setup-fixture.ts
CHANGED
|
@@ -70,3 +70,15 @@ export const context: ContentPageContext = {
|
|
|
70
70
|
};
|
|
71
71
|
},
|
|
72
72
|
};
|
|
73
|
+
|
|
74
|
+
export const mobileContext: ContentPageContext = {
|
|
75
|
+
...context,
|
|
76
|
+
useRouter: () => ({
|
|
77
|
+
href: `${TEST_ORIGIN}/mobile/credits`,
|
|
78
|
+
pathname: '/mobile/credits',
|
|
79
|
+
query: {},
|
|
80
|
+
push: (url: string) => {
|
|
81
|
+
console.log(url);
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
};
|
package/src/useLink.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HandlerDecorator, Router } from './ContentPageContext';
|
|
2
2
|
import type { LinkContent } from './types';
|
|
3
|
-
import {
|
|
3
|
+
import { adjustHref, isURL } from './utils/url';
|
|
4
4
|
|
|
5
5
|
const defaultHandlerDecorator: HandlerDecorator = (handler, targetContent) => handler;
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ export function useLink(
|
|
|
11
11
|
}: { router: Router; handlerDecorator?: HandlerDecorator },
|
|
12
12
|
link: Partial<LinkContent>,
|
|
13
13
|
) {
|
|
14
|
-
const href =
|
|
14
|
+
const href = adjustHref(link.href, router);
|
|
15
15
|
return {
|
|
16
16
|
...link,
|
|
17
17
|
href,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { adjustHref, getOrigin, toRelativeHref, withoutQuery } from './url';
|
|
2
|
+
|
|
3
|
+
describe('url', () => {
|
|
4
|
+
describe('withoutQuery', () => {
|
|
5
|
+
it('should return URL without query params', () => {
|
|
6
|
+
expect(withoutQuery('http://foo.ru/other/path?first=1&second=2')).toBe(
|
|
7
|
+
'http://foo.ru/other/path',
|
|
8
|
+
);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('getOrigin', () => {
|
|
13
|
+
it('should return origin of specified URL', () => {
|
|
14
|
+
expect(getOrigin('http://foo.ru/other/path?first=1&second=2')).toBe('http://foo.ru');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('adjustHref', () => {
|
|
19
|
+
it('should compute URL relative to some base URL', () => {
|
|
20
|
+
expect(
|
|
21
|
+
adjustHref('http://foo.ru/other/path', {
|
|
22
|
+
pathname: '/some/path',
|
|
23
|
+
href: 'http://foo.ru/some/path',
|
|
24
|
+
}),
|
|
25
|
+
).toBe('/other/path');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should compute mobile URL for mobile pages', () => {
|
|
29
|
+
expect(
|
|
30
|
+
adjustHref('http://foo.ru/other/path', {
|
|
31
|
+
pathname: '/mobile/some/path',
|
|
32
|
+
href: 'http://foo.ru/mobile/some/path',
|
|
33
|
+
}),
|
|
34
|
+
).toBe('/mobile/other/path');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should return nothing if nothing provided', () => {
|
|
38
|
+
expect(adjustHref(undefined, { pathname: '/mobile/some/path' })).toBe(undefined);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('toRelativeHref', () => {
|
|
43
|
+
it('should compute URL relative to some base URL', () => {
|
|
44
|
+
expect(toRelativeHref('http://foo.ru/other/path', { href: 'http://foo.ru/some/path' })).toBe(
|
|
45
|
+
'/other/path',
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should return nothing if nothing provided', () => {
|
|
50
|
+
expect(toRelativeHref(undefined, {})).toBe(undefined);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
package/src/utils/url.ts
CHANGED
|
@@ -1,22 +1,52 @@
|
|
|
1
|
+
export const MOBILE_URL_PATH = '/mobile';
|
|
2
|
+
|
|
1
3
|
export const isURL = (href?: string) => href?.includes('//');
|
|
2
4
|
|
|
5
|
+
export const isHrefActive = (
|
|
6
|
+
href: string | undefined,
|
|
7
|
+
router: { pathname?: string; href?: string },
|
|
8
|
+
cmp: (href: string, baseHref: string) => boolean = (href, baseHref) => href === baseHref,
|
|
9
|
+
) => {
|
|
10
|
+
return cmp(
|
|
11
|
+
withoutQuery(href),
|
|
12
|
+
withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)),
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
3
16
|
export const withoutQuery = (href?: string) => (href || '').replace(/\/?\?.*/, '');
|
|
4
17
|
|
|
18
|
+
export const withoutMobilePath = (href?: string) => (href || '').replace(MOBILE_URL_PATH, '');
|
|
19
|
+
|
|
5
20
|
export const getOrigin = (href?: string) => {
|
|
6
|
-
if (isURL(href)) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
if (!isURL(href)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const url = href!;
|
|
26
|
+
const protoSeparator = '//';
|
|
27
|
+
const endOfProto = url.indexOf(protoSeparator);
|
|
28
|
+
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
29
|
+
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const adjustHref = (
|
|
33
|
+
href: string | undefined,
|
|
34
|
+
router: { pathname: string; href?: string },
|
|
35
|
+
) => {
|
|
36
|
+
if (!href) {
|
|
37
|
+
return href;
|
|
12
38
|
}
|
|
13
|
-
|
|
39
|
+
|
|
40
|
+
const relativeHref = toRelativeHref(href, router)!;
|
|
41
|
+
const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
|
|
42
|
+
return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
|
|
14
43
|
};
|
|
15
44
|
|
|
16
|
-
export const toRelativeHref = (href
|
|
45
|
+
export const toRelativeHref = (href: string | undefined, router: { href?: string }) => {
|
|
17
46
|
if (!href) {
|
|
18
47
|
return href;
|
|
19
48
|
}
|
|
20
|
-
|
|
49
|
+
|
|
50
|
+
const origin = getOrigin(router?.href);
|
|
21
51
|
return origin ? href.replace(origin, '') || '/' : href;
|
|
22
52
|
};
|