@redneckz/wildless-cms-uni-blocks 0.14.81 → 0.14.82
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/bundle/bundle.umd.js +1 -1
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +6 -0
- package/bundle/components/StickyBottomMenu/StickyBottomMenuItem.d.ts +8 -0
- package/bundle/components/StickyBottomMenu/StickyBottomMenuProps.d.ts +1 -4
- package/bundle/hooks/useActiveRoute.d.ts +3 -2
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +11 -18
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +6 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js +8 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuItem.d.ts +8 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuItem.js +15 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
- package/dist/components/StickyBottomMenu/StickyBottomMenuProps.d.ts +1 -4
- package/dist/hooks/useActiveRoute.d.ts +3 -2
- package/dist/hooks/useActiveRoute.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +12 -19
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +6 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js +6 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuItem.d.ts +8 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuItem.js +13 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
- package/lib/components/StickyBottomMenu/StickyBottomMenuProps.d.ts +1 -4
- package/lib/hooks/useActiveRoute.d.ts +3 -2
- package/lib/hooks/useActiveRoute.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +15 -36
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +6 -0
- package/mobile/bundle/components/StickyBottomMenu/StickyBottomMenuItem.d.ts +8 -0
- package/mobile/bundle/components/StickyBottomMenu/StickyBottomMenuProps.d.ts +1 -4
- package/mobile/bundle/hooks/useActiveRoute.d.ts +3 -2
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +11 -18
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +6 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js +8 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuItem.d.ts +8 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuItem.js +15 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuProps.d.ts +1 -4
- package/mobile/dist/hooks/useActiveRoute.d.ts +3 -2
- package/mobile/dist/hooks/useActiveRoute.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +12 -19
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuBurger.d.ts +6 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js +6 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuItem.d.ts +8 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuItem.js +13 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuProps.d.ts +1 -4
- package/mobile/lib/hooks/useActiveRoute.d.ts +3 -2
- package/mobile/lib/hooks/useActiveRoute.js.map +1 -1
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +28 -23
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx +21 -0
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenuItem.tsx +42 -0
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenuProps.tsx +1 -5
- package/mobile/src/hooks/useActiveRoute.ts +3 -4
- package/package.json +1 -1
- package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +28 -23
- package/src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx +21 -0
- package/src/components/StickyBottomMenu/StickyBottomMenuItem.tsx +42 -0
- package/src/components/StickyBottomMenu/StickyBottomMenuProps.tsx +1 -5
- package/src/hooks/useActiveRoute.ts +3 -4
- package/bundle/components/StickyBottomMenu/RenderItem.d.ts +0 -8
- package/bundle/components/StickyBottomMenu/RenderMenuItems.d.ts +0 -7
- package/dist/components/StickyBottomMenu/RenderItem.d.ts +0 -8
- package/dist/components/StickyBottomMenu/RenderItem.js +0 -25
- package/dist/components/StickyBottomMenu/RenderItem.js.map +0 -1
- package/dist/components/StickyBottomMenu/RenderMenuItems.d.ts +0 -7
- package/dist/components/StickyBottomMenu/RenderMenuItems.js +0 -11
- package/dist/components/StickyBottomMenu/RenderMenuItems.js.map +0 -1
- package/lib/components/StickyBottomMenu/RenderItem.d.ts +0 -8
- package/lib/components/StickyBottomMenu/RenderItem.js +0 -23
- package/lib/components/StickyBottomMenu/RenderItem.js.map +0 -1
- package/lib/components/StickyBottomMenu/RenderMenuItems.d.ts +0 -7
- package/lib/components/StickyBottomMenu/RenderMenuItems.js +0 -9
- package/lib/components/StickyBottomMenu/RenderMenuItems.js.map +0 -1
- package/mobile/bundle/components/StickyBottomMenu/RenderItem.d.ts +0 -8
- package/mobile/bundle/components/StickyBottomMenu/RenderMenuItems.d.ts +0 -7
- package/mobile/dist/components/StickyBottomMenu/RenderItem.d.ts +0 -8
- package/mobile/dist/components/StickyBottomMenu/RenderItem.js +0 -25
- package/mobile/dist/components/StickyBottomMenu/RenderItem.js.map +0 -1
- package/mobile/dist/components/StickyBottomMenu/RenderMenuItems.d.ts +0 -7
- package/mobile/dist/components/StickyBottomMenu/RenderMenuItems.js +0 -11
- package/mobile/dist/components/StickyBottomMenu/RenderMenuItems.js.map +0 -1
- package/mobile/lib/components/StickyBottomMenu/RenderItem.d.ts +0 -8
- package/mobile/lib/components/StickyBottomMenu/RenderItem.js +0 -23
- package/mobile/lib/components/StickyBottomMenu/RenderItem.js.map +0 -1
- package/mobile/lib/components/StickyBottomMenu/RenderMenuItems.d.ts +0 -7
- package/mobile/lib/components/StickyBottomMenu/RenderMenuItems.js +0 -9
- package/mobile/lib/components/StickyBottomMenu/RenderMenuItems.js.map +0 -1
- package/mobile/src/components/StickyBottomMenu/RenderItem.tsx +0 -51
- package/mobile/src/components/StickyBottomMenu/RenderMenuItems.tsx +0 -21
- package/src/components/StickyBottomMenu/RenderItem.tsx +0 -51
- package/src/components/StickyBottomMenu/RenderMenuItems.tsx +0 -21
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MenuItem } from './StickyBottomMenuContent';
|
|
2
|
+
interface StickyBottomMenuItemProps {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
item?: MenuItem;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const StickyBottomMenuItem: import("@redneckz/uni-jsx").UNIComponent<StickyBottomMenuItemProps, any, any>;
|
|
8
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type UniBlockProps } from '../../model/JSXBlock';
|
|
2
2
|
import { type MenuItem, type StickyBottomMenuContent } from './StickyBottomMenuContent';
|
|
3
|
-
export interface MenuItemProps extends MenuItem {
|
|
4
|
-
isActive?: boolean;
|
|
5
|
-
}
|
|
6
3
|
export interface StickyBottomMenuProps extends StickyBottomMenuContent, UniBlockProps {
|
|
7
|
-
menuItems?:
|
|
4
|
+
menuItems?: MenuItem[];
|
|
8
5
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function useActiveRoute<T extends {
|
|
2
|
+
href?: string;
|
|
3
|
+
}>(items?: T[] | undefined): [number, T];
|
|
@@ -2,30 +2,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
2
2
|
exports.StickyBottomMenu = void 0;
|
|
3
3
|
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
4
|
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
-
const
|
|
5
|
+
const useActiveRoute_1 = require("../../hooks/useActiveRoute");
|
|
6
6
|
const useSWRResource_1 = require("../../hooks/useSWRResource");
|
|
7
7
|
const ProjectSettings_1 = require("../../ProjectSettings");
|
|
8
8
|
const BlockWrapper_1 = require("../../ui-kit/BlockWrapper");
|
|
9
|
-
const
|
|
9
|
+
const StickyBottomMenuBurger_1 = require("./StickyBottomMenuBurger");
|
|
10
|
+
const StickyBottomMenuItem_1 = require("./StickyBottomMenuItem");
|
|
10
11
|
const useBurgerMenuDialog_1 = require("./useBurgerMenuDialog");
|
|
12
|
+
const EMPTY_MENU = [];
|
|
11
13
|
exports.StickyBottomMenu = (0, uni_jsx_1.JSX)(({ ...rest }) => {
|
|
12
|
-
const {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
title: 'Меню',
|
|
16
|
-
icon: {
|
|
17
|
-
icon: 'BurgerIcon',
|
|
18
|
-
iconVersion: isBurgerMenuDialogOpen ? 'color' : 'black',
|
|
19
|
-
},
|
|
20
|
-
isActive: isBurgerMenuDialogOpen,
|
|
21
|
-
};
|
|
14
|
+
const [isBurgerMenuDialogOpen, { toggle, close }] = (0, useBurgerMenuDialog_1.useBurgerMenuDialog)();
|
|
15
|
+
const { menuItems = EMPTY_MENU } = (0, useSWRResource_1.useSWRResource)(ProjectSettings_1.projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu', { fallback: rest.options?.page?.fallback, folderName: 'portal-resources', setBasePath: true });
|
|
16
|
+
const [, activeItem] = (0, useActiveRoute_1.useActiveRoute)(menuItems);
|
|
22
17
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
burgerMenu,
|
|
26
|
-
...menuItems.slice(middleIdx),
|
|
27
|
-
], [menuItems, middleIdx, burgerMenu]);
|
|
18
|
+
const leftItems = menuItems.slice(0, middleIdx);
|
|
19
|
+
const rightItems = menuItems.slice(middleIdx);
|
|
28
20
|
/* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
|
|
29
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "w-full mb-5", "data-component": "sticky-bottom-menu-container", children: (0, jsx_runtime_1.jsx)(BlockWrapper_1.BlockWrapper, { className: "@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]", padding: "p-0", children: (0, jsx_runtime_1.jsx)(
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "w-full mb-5", "data-component": "sticky-bottom-menu-container", children: (0, jsx_runtime_1.jsx)(BlockWrapper_1.BlockWrapper, { className: "@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]", padding: "p-0", children: (0, jsx_runtime_1.jsxs)("div", { className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(activeItem, close)), (0, jsx_runtime_1.jsx)(StickyBottomMenuBurger_1.StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: toggle }), rightItems.map(renderMenuItem(activeItem, close))] }) }) }));
|
|
30
22
|
});
|
|
23
|
+
const renderMenuItem = (activeItem, close) => (_, i) => ((0, jsx_runtime_1.jsx)(StickyBottomMenuItem_1.StickyBottomMenuItem, { isActive: _ === activeItem, item: _, onClick: close }, _.href || String(i)));
|
|
31
24
|
//# sourceMappingURL=StickyBottomMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC
|
|
1
|
+
{"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,+DAA4D;AAC5D,+DAA4D;AAC5D,2DAAwD;AACxD,4DAAyD;AACzD,qEAAkE;AAElE,iEAA8D;AAE9D,+DAA4D;AAE5D,MAAM,UAAU,GAAG,EAAE,CAAC;AAET,QAAA,gBAAgB,GAAG,IAAA,aAAG,EAAwB,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACzE,MAAM,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAA,yCAAmB,GAAE,CAAC;IAE1E,MAAM,EAAE,SAAS,GAAG,UAAU,EAAE,GAAG,IAAA,+BAAc,EAC/C,iCAAe,CAAC,kBAAkB,IAAI,oBAAoB,EAC1D,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,CAC9F,CAAC;IAEF,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,IAAA,+BAAc,EAAC,SAAS,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAE9C,uFAAuF;IACvF,OAAO,CACL,gCAAK,SAAS,EAAC,aAAa,oBAAgB,8BAA8B,YACxE,uBAAC,2BAAY,IACX,SAAS,EAAC,6FAA6F,EACvG,OAAO,EAAC,KAAK,YAEb,iCAAK,SAAS,EAAC,iEAAiE,aAC7E,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,EACjD,uBAAC,+CAAsB,IAAC,QAAQ,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,GAAI,EAC5E,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,IAC9C,GACO,GACX,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,UAAoB,EAAE,KAAiB,EAAE,EAAE,CAAC,CAAC,CAAW,EAAE,CAAS,EAAE,EAAE,CAC7F,CACE,uBAAC,2CAAoB,IAEnB,QAAQ,EAAE,CAAC,KAAK,UAAU,EAC1B,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,KAAK,IAHT,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAIxB,CACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.StickyBottomMenuBurger = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const Icon_1 = require("../../ui-kit/Icon/Icon");
|
|
6
|
+
const style_1 = require("../../utils/style");
|
|
7
|
+
exports.StickyBottomMenuBurger = (0, uni_jsx_1.JSX)(({ isActive, onClick }) => ((0, jsx_runtime_1.jsxs)("button", { className: (0, style_1.style)(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), onClick: onClick, children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { className: "w-6 h-6", name: "BurgerIcon", iconVersion: isActive ? 'color' : 'black' }), "\u041C\u0435\u043D\u044E"] })));
|
|
8
|
+
//# sourceMappingURL=StickyBottomMenuBurger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyBottomMenuBurger.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,iDAA8C;AAC9C,6CAA0C;AAO7B,QAAA,sBAAsB,GAAG,IAAA,aAAG,EAA8B,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChG,oCACE,SAAS,EAAE,IAAA,aAAK,EACd,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,EACpD,2EAA2E,CAC5E,EACD,OAAO,EAAE,OAAO,aAEhB,uBAAC,WAAI,IAAC,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,YAAY,EAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAI,gCAElF,CACV,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MenuItem } from './StickyBottomMenuContent';
|
|
2
|
+
interface StickyBottomMenuItemProps {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
item?: MenuItem;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const StickyBottomMenuItem: import("@redneckz/uni-jsx").UNIComponent<StickyBottomMenuItemProps, any, any>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.StickyBottomMenuItem = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const useLink_1 = require("../../hooks/useLink");
|
|
6
|
+
const ProjectSettings_1 = require("../../ProjectSettings");
|
|
7
|
+
const Icon_1 = require("../../ui-kit/Icon/Icon");
|
|
8
|
+
const style_1 = require("../../utils/style");
|
|
9
|
+
exports.StickyBottomMenuItem = (0, uni_jsx_1.JSX)(({ isActive, item, onClick }) => {
|
|
10
|
+
const isAnotherPortal = !ProjectSettings_1.projectSettings?.BASE_PATH || !item?.href?.startsWith(ProjectSettings_1.projectSettings.BASE_PATH);
|
|
11
|
+
const link = (0, useLink_1.useLink)({ isRemote: isAnotherPortal });
|
|
12
|
+
const { href, onClick: handleClick } = link({ href: item?.href, onClick });
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("a", { className: (0, style_1.style)(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), href: href, target: "_self", title: item?.title || '', onClick: handleClick, children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { className: "w-6 h-6", name: item?.icon?.icon, iconVersion: isActive ? 'color' : 'black' }), item?.title || ''] }));
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=StickyBottomMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyBottomMenuItem.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,iDAA8C;AAC9C,2DAAwD;AACxD,iDAA8C;AAC9C,6CAA0C;AAS7B,QAAA,oBAAoB,GAAG,IAAA,aAAG,EACrC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IAC9B,MAAM,eAAe,GACnB,CAAC,iCAAe,EAAE,SAAS,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,iCAAe,CAAC,SAAS,CAAC,CAAC;IAEpF,MAAM,IAAI,GAAG,IAAA,iBAAO,EAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAE3E,OAAO,CACL,+BACE,SAAS,EAAE,IAAA,aAAK,EACd,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,EACpD,2EAA2E,CAC5E,EACD,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,OAAO,EACd,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,EACxB,OAAO,EAAE,WAAW,aAEpB,uBAAC,WAAI,IACH,SAAS,EAAC,SAAS,EACnB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EACtB,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GACzC,EACD,IAAI,EAAE,KAAK,IAAI,EAAE,IAChB,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type UniBlockProps } from '../../model/JSXBlock';
|
|
2
2
|
import { type MenuItem, type StickyBottomMenuContent } from './StickyBottomMenuContent';
|
|
3
|
-
export interface MenuItemProps extends MenuItem {
|
|
4
|
-
isActive?: boolean;
|
|
5
|
-
}
|
|
6
3
|
export interface StickyBottomMenuProps extends StickyBottomMenuContent, UniBlockProps {
|
|
7
|
-
menuItems?:
|
|
4
|
+
menuItems?: MenuItem[];
|
|
8
5
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function useActiveRoute<T extends {
|
|
2
|
+
href?: string;
|
|
3
|
+
}>(items?: T[] | undefined): [number, T];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveRoute.js","sourceRoot":"","sources":["../../src/hooks/useActiveRoute.ts"],"names":[],"mappings":";;AAAA,0EAAuE;
|
|
1
|
+
{"version":3,"file":"useActiveRoute.js","sourceRoot":"","sources":["../../src/hooks/useActiveRoute.ts"],"names":[],"mappings":";;AAAA,0EAAuE;AACvE,2CAAwC;AAExC,SAAgB,cAAc,CAC5B,QAAyB,EAAE;IAE3B,MAAM,MAAM,GAAG,IAAA,qBAAS,GAAE,CAAC;IAC3B,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,IAAA,iCAAe,EAAC,MAAM,CAAC,CAAC,CAAC;IAE7D,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;AAC3C,CAAC;AAPD,wCAOC"}
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
-
import {
|
|
3
|
+
import { useActiveRoute } from '../../hooks/useActiveRoute.js';
|
|
4
4
|
import { useSWRResource } from '../../hooks/useSWRResource.js';
|
|
5
5
|
import { projectSettings } from '../../ProjectSettings.js';
|
|
6
6
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
|
|
7
|
-
import {
|
|
7
|
+
import { StickyBottomMenuBurger } from './StickyBottomMenuBurger.js';
|
|
8
|
+
import { StickyBottomMenuItem } from './StickyBottomMenuItem.js';
|
|
8
9
|
import { useBurgerMenuDialog } from './useBurgerMenuDialog.js';
|
|
10
|
+
const EMPTY_MENU = [];
|
|
9
11
|
export const StickyBottomMenu = JSX(({ ...rest }) => {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
title: 'Меню',
|
|
14
|
-
icon: {
|
|
15
|
-
icon: 'BurgerIcon',
|
|
16
|
-
iconVersion: isBurgerMenuDialogOpen ? 'color' : 'black',
|
|
17
|
-
},
|
|
18
|
-
isActive: isBurgerMenuDialogOpen,
|
|
19
|
-
};
|
|
12
|
+
const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog();
|
|
13
|
+
const { menuItems = EMPTY_MENU } = useSWRResource(projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu', { fallback: rest.options?.page?.fallback, folderName: 'portal-resources', setBasePath: true });
|
|
14
|
+
const [, activeItem] = useActiveRoute(menuItems);
|
|
20
15
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
burgerMenu,
|
|
24
|
-
...menuItems.slice(middleIdx),
|
|
25
|
-
], [menuItems, middleIdx, burgerMenu]);
|
|
16
|
+
const leftItems = menuItems.slice(0, middleIdx);
|
|
17
|
+
const rightItems = menuItems.slice(middleIdx);
|
|
26
18
|
/* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
|
|
27
|
-
return (_jsx("div", { className: "w-full mb-5", "data-component": "sticky-bottom-menu-container", children: _jsx(BlockWrapper, { className: "@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]", padding: "p-0", children: _jsx(
|
|
19
|
+
return (_jsx("div", { className: "w-full mb-5", "data-component": "sticky-bottom-menu-container", children: _jsx(BlockWrapper, { className: "@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]", padding: "p-0", children: _jsxs("div", { className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(activeItem, close)), _jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: toggle }), rightItems.map(renderMenuItem(activeItem, close))] }) }) }));
|
|
28
20
|
});
|
|
21
|
+
const renderMenuItem = (activeItem, close) => (_, i) => (_jsx(StickyBottomMenuItem, { isActive: _ === activeItem, item: _, onClick: close }, _.href || String(i)));
|
|
29
22
|
//# sourceMappingURL=StickyBottomMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAwB,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACzE,MAAM,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,mBAAmB,EAAE,CAAC;IAE1E,MAAM,EAAE,SAAS,GAAG,UAAU,EAAE,GAAG,cAAc,CAC/C,eAAe,CAAC,kBAAkB,IAAI,oBAAoB,EAC1D,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,CAC9F,CAAC;IAEF,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAEjD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAE9C,uFAAuF;IACvF,OAAO,CACL,cAAK,SAAS,EAAC,aAAa,oBAAgB,8BAA8B,YACxE,KAAC,YAAY,IACX,SAAS,EAAC,6FAA6F,EACvG,OAAO,EAAC,KAAK,YAEb,eAAK,SAAS,EAAC,iEAAiE,aAC7E,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,EACjD,KAAC,sBAAsB,IAAC,QAAQ,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,GAAI,EAC5E,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,IAC9C,GACO,GACX,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,UAAoB,EAAE,KAAiB,EAAE,EAAE,CAAC,CAAC,CAAW,EAAE,CAAS,EAAE,EAAE,CAC7F,CACE,KAAC,oBAAoB,IAEnB,QAAQ,EAAE,CAAC,KAAK,UAAU,EAC1B,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,KAAK,IAHT,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAIxB,CACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { Icon } from '../../ui-kit/Icon/Icon.js';
|
|
4
|
+
import { style } from '../../utils/style.js';
|
|
5
|
+
export const StickyBottomMenuBurger = JSX(({ isActive, onClick }) => (_jsxs("button", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), onClick: onClick, children: [_jsx(Icon, { className: "w-6 h-6", name: "BurgerIcon", iconVersion: isActive ? 'color' : 'black' }), "\u041C\u0435\u043D\u044E"] })));
|
|
6
|
+
//# sourceMappingURL=StickyBottomMenuBurger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyBottomMenuBurger.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuBurger.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAA8B,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChG,kBACE,SAAS,EAAE,KAAK,CACd,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,EACpD,2EAA2E,CAC5E,EACD,OAAO,EAAE,OAAO,aAEhB,KAAC,IAAI,IAAC,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,YAAY,EAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAI,gCAElF,CACV,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MenuItem } from './StickyBottomMenuContent';
|
|
2
|
+
interface StickyBottomMenuItemProps {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
item?: MenuItem;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const StickyBottomMenuItem: import("@redneckz/uni-jsx").UNIComponent<StickyBottomMenuItemProps, any, any>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { useLink } from '../../hooks/useLink.js';
|
|
4
|
+
import { projectSettings } from '../../ProjectSettings.js';
|
|
5
|
+
import { Icon } from '../../ui-kit/Icon/Icon.js';
|
|
6
|
+
import { style } from '../../utils/style.js';
|
|
7
|
+
export const StickyBottomMenuItem = JSX(({ isActive, item, onClick }) => {
|
|
8
|
+
const isAnotherPortal = !projectSettings?.BASE_PATH || !item?.href?.startsWith(projectSettings.BASE_PATH);
|
|
9
|
+
const link = useLink({ isRemote: isAnotherPortal });
|
|
10
|
+
const { href, onClick: handleClick } = link({ href: item?.href, onClick });
|
|
11
|
+
return (_jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), href: href, target: "_self", title: item?.title || '', onClick: handleClick, children: [_jsx(Icon, { className: "w-6 h-6", name: item?.icon?.icon, iconVersion: isActive ? 'color' : 'black' }), item?.title || ''] }));
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=StickyBottomMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyBottomMenuItem.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CACrC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IAC9B,MAAM,eAAe,GACnB,CAAC,eAAe,EAAE,SAAS,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAEpF,MAAM,IAAI,GAAG,OAAO,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAE3E,OAAO,CACL,aACE,SAAS,EAAE,KAAK,CACd,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,EACpD,2EAA2E,CAC5E,EACD,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,OAAO,EACd,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,EACxB,OAAO,EAAE,WAAW,aAEpB,KAAC,IAAI,IACH,SAAS,EAAC,SAAS,EACnB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EACtB,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GACzC,EACD,IAAI,EAAE,KAAK,IAAI,EAAE,IAChB,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type UniBlockProps } from '../../model/JSXBlock';
|
|
2
2
|
import { type MenuItem, type StickyBottomMenuContent } from './StickyBottomMenuContent';
|
|
3
|
-
export interface MenuItemProps extends MenuItem {
|
|
4
|
-
isActive?: boolean;
|
|
5
|
-
}
|
|
6
3
|
export interface StickyBottomMenuProps extends StickyBottomMenuContent, UniBlockProps {
|
|
7
|
-
menuItems?:
|
|
4
|
+
menuItems?: MenuItem[];
|
|
8
5
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function useActiveRoute<T extends {
|
|
2
|
+
href?: string;
|
|
3
|
+
}>(items?: T[] | undefined): [number, T];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveRoute.js","sourceRoot":"","sources":["../../src/hooks/useActiveRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"useActiveRoute.js","sourceRoot":"","sources":["../../src/hooks/useActiveRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,UAAU,cAAc,CAC5B,QAAyB,EAAE;IAE3B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7D,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useActiveRoute } from '../../hooks/useActiveRoute';
|
|
3
3
|
import { useSWRResource } from '../../hooks/useSWRResource';
|
|
4
4
|
import { projectSettings } from '../../ProjectSettings';
|
|
5
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { StickyBottomMenuBurger } from './StickyBottomMenuBurger';
|
|
7
|
+
import type { MenuItem } from './StickyBottomMenuContent';
|
|
8
|
+
import { StickyBottomMenuItem } from './StickyBottomMenuItem';
|
|
9
|
+
import { type StickyBottomMenuProps } from './StickyBottomMenuProps';
|
|
8
10
|
import { useBurgerMenuDialog } from './useBurgerMenuDialog';
|
|
9
11
|
|
|
12
|
+
const EMPTY_MENU = [];
|
|
13
|
+
|
|
10
14
|
export const StickyBottomMenu = JSX<StickyBottomMenuProps>(({ ...rest }) => {
|
|
11
|
-
const {
|
|
15
|
+
const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog();
|
|
16
|
+
|
|
17
|
+
const { menuItems = EMPTY_MENU } = useSWRResource<StickyBottomMenuProps>(
|
|
12
18
|
projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu',
|
|
13
19
|
{ fallback: rest.options?.page?.fallback, folderName: 'portal-resources', setBasePath: true },
|
|
14
20
|
);
|
|
15
21
|
|
|
16
|
-
const [
|
|
22
|
+
const [, activeItem] = useActiveRoute(menuItems);
|
|
17
23
|
|
|
18
|
-
const burgerMenu = {
|
|
19
|
-
title: 'Меню',
|
|
20
|
-
icon: {
|
|
21
|
-
icon: 'BurgerIcon',
|
|
22
|
-
iconVersion: isBurgerMenuDialogOpen ? 'color' : 'black',
|
|
23
|
-
},
|
|
24
|
-
isActive: isBurgerMenuDialogOpen,
|
|
25
|
-
};
|
|
26
24
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
[
|
|
30
|
-
...menuItems.slice(0, middleIdx),
|
|
31
|
-
burgerMenu,
|
|
32
|
-
...menuItems.slice(middleIdx),
|
|
33
|
-
] as MenuItemProps[],
|
|
34
|
-
[menuItems, middleIdx, burgerMenu],
|
|
35
|
-
);
|
|
25
|
+
const leftItems = menuItems.slice(0, middleIdx);
|
|
26
|
+
const rightItems = menuItems.slice(middleIdx);
|
|
36
27
|
|
|
37
28
|
/* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
|
|
38
29
|
return (
|
|
@@ -41,8 +32,22 @@ export const StickyBottomMenu = JSX<StickyBottomMenuProps>(({ ...rest }) => {
|
|
|
41
32
|
className="@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]"
|
|
42
33
|
padding="p-0"
|
|
43
34
|
>
|
|
44
|
-
<
|
|
35
|
+
<div className="ml-auto container bg-white flex justify-center shadow-blue-gray">
|
|
36
|
+
{leftItems.map(renderMenuItem(activeItem, close))}
|
|
37
|
+
<StickyBottomMenuBurger isActive={isBurgerMenuDialogOpen} onClick={toggle} />
|
|
38
|
+
{rightItems.map(renderMenuItem(activeItem, close))}
|
|
39
|
+
</div>
|
|
45
40
|
</BlockWrapper>
|
|
46
41
|
</div>
|
|
47
42
|
);
|
|
48
43
|
});
|
|
44
|
+
|
|
45
|
+
const renderMenuItem = (activeItem: MenuItem, close: () => void) => (_: MenuItem, i: number) =>
|
|
46
|
+
(
|
|
47
|
+
<StickyBottomMenuItem
|
|
48
|
+
key={_.href || String(i)}
|
|
49
|
+
isActive={_ === activeItem}
|
|
50
|
+
item={_}
|
|
51
|
+
onClick={close}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
3
|
+
import { style } from '../../utils/style';
|
|
4
|
+
|
|
5
|
+
interface StickyBottomMenuBurgerProps {
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const StickyBottomMenuBurger = JSX<StickyBottomMenuBurgerProps>(({ isActive, onClick }) => (
|
|
11
|
+
<button
|
|
12
|
+
className={style(
|
|
13
|
+
isActive ? 'text-primary-main' : 'text-primary-text',
|
|
14
|
+
`w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`,
|
|
15
|
+
)}
|
|
16
|
+
onClick={onClick}
|
|
17
|
+
>
|
|
18
|
+
<Icon className="w-6 h-6" name="BurgerIcon" iconVersion={isActive ? 'color' : 'black'} />
|
|
19
|
+
Меню
|
|
20
|
+
</button>
|
|
21
|
+
));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useLink } from '../../hooks/useLink';
|
|
3
|
+
import { projectSettings } from '../../ProjectSettings';
|
|
4
|
+
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
5
|
+
import { style } from '../../utils/style';
|
|
6
|
+
import type { MenuItem } from './StickyBottomMenuContent';
|
|
7
|
+
|
|
8
|
+
interface StickyBottomMenuItemProps {
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
item?: MenuItem;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const StickyBottomMenuItem = JSX<StickyBottomMenuItemProps>(
|
|
15
|
+
({ isActive, item, onClick }) => {
|
|
16
|
+
const isAnotherPortal =
|
|
17
|
+
!projectSettings?.BASE_PATH || !item?.href?.startsWith(projectSettings.BASE_PATH);
|
|
18
|
+
|
|
19
|
+
const link = useLink({ isRemote: isAnotherPortal });
|
|
20
|
+
const { href, onClick: handleClick } = link({ href: item?.href, onClick });
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<a
|
|
24
|
+
className={style(
|
|
25
|
+
isActive ? 'text-primary-main' : 'text-primary-text',
|
|
26
|
+
`w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`,
|
|
27
|
+
)}
|
|
28
|
+
href={href}
|
|
29
|
+
target="_self"
|
|
30
|
+
title={item?.title || ''}
|
|
31
|
+
onClick={handleClick}
|
|
32
|
+
>
|
|
33
|
+
<Icon
|
|
34
|
+
className="w-6 h-6"
|
|
35
|
+
name={item?.icon?.icon}
|
|
36
|
+
iconVersion={isActive ? 'color' : 'black'}
|
|
37
|
+
/>
|
|
38
|
+
{item?.title || ''}
|
|
39
|
+
</a>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { type UniBlockProps } from '../../model/JSXBlock';
|
|
2
2
|
import { type MenuItem, type StickyBottomMenuContent } from './StickyBottomMenuContent';
|
|
3
3
|
|
|
4
|
-
export interface MenuItemProps extends MenuItem {
|
|
5
|
-
isActive?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
4
|
export interface StickyBottomMenuProps extends StickyBottomMenuContent, UniBlockProps {
|
|
9
|
-
menuItems?:
|
|
5
|
+
menuItems?: MenuItem[];
|
|
10
6
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isTopItemActive } from '../components/Header/isTopItemActive';
|
|
2
|
-
import { type TopMenuItemProps } from '../services/sitemap/SitemapData';
|
|
3
2
|
import { useRouter } from './useRouter';
|
|
4
3
|
|
|
5
|
-
export function useActiveRoute(
|
|
6
|
-
items:
|
|
7
|
-
): [number,
|
|
4
|
+
export function useActiveRoute<T extends { href?: string }>(
|
|
5
|
+
items: T[] | undefined = [],
|
|
6
|
+
): [number, T] {
|
|
8
7
|
const router = useRouter();
|
|
9
8
|
const activeIndex = items.findIndex(isTopItemActive(router));
|
|
10
9
|
|
package/package.json
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useActiveRoute } from '../../hooks/useActiveRoute';
|
|
3
3
|
import { useSWRResource } from '../../hooks/useSWRResource';
|
|
4
4
|
import { projectSettings } from '../../ProjectSettings';
|
|
5
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { StickyBottomMenuBurger } from './StickyBottomMenuBurger';
|
|
7
|
+
import type { MenuItem } from './StickyBottomMenuContent';
|
|
8
|
+
import { StickyBottomMenuItem } from './StickyBottomMenuItem';
|
|
9
|
+
import { type StickyBottomMenuProps } from './StickyBottomMenuProps';
|
|
8
10
|
import { useBurgerMenuDialog } from './useBurgerMenuDialog';
|
|
9
11
|
|
|
12
|
+
const EMPTY_MENU = [];
|
|
13
|
+
|
|
10
14
|
export const StickyBottomMenu = JSX<StickyBottomMenuProps>(({ ...rest }) => {
|
|
11
|
-
const {
|
|
15
|
+
const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog();
|
|
16
|
+
|
|
17
|
+
const { menuItems = EMPTY_MENU } = useSWRResource<StickyBottomMenuProps>(
|
|
12
18
|
projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu',
|
|
13
19
|
{ fallback: rest.options?.page?.fallback, folderName: 'portal-resources', setBasePath: true },
|
|
14
20
|
);
|
|
15
21
|
|
|
16
|
-
const [
|
|
22
|
+
const [, activeItem] = useActiveRoute(menuItems);
|
|
17
23
|
|
|
18
|
-
const burgerMenu = {
|
|
19
|
-
title: 'Меню',
|
|
20
|
-
icon: {
|
|
21
|
-
icon: 'BurgerIcon',
|
|
22
|
-
iconVersion: isBurgerMenuDialogOpen ? 'color' : 'black',
|
|
23
|
-
},
|
|
24
|
-
isActive: isBurgerMenuDialogOpen,
|
|
25
|
-
};
|
|
26
24
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
[
|
|
30
|
-
...menuItems.slice(0, middleIdx),
|
|
31
|
-
burgerMenu,
|
|
32
|
-
...menuItems.slice(middleIdx),
|
|
33
|
-
] as MenuItemProps[],
|
|
34
|
-
[menuItems, middleIdx, burgerMenu],
|
|
35
|
-
);
|
|
25
|
+
const leftItems = menuItems.slice(0, middleIdx);
|
|
26
|
+
const rightItems = menuItems.slice(middleIdx);
|
|
36
27
|
|
|
37
28
|
/* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
|
|
38
29
|
return (
|
|
@@ -41,8 +32,22 @@ export const StickyBottomMenu = JSX<StickyBottomMenuProps>(({ ...rest }) => {
|
|
|
41
32
|
className="@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]"
|
|
42
33
|
padding="p-0"
|
|
43
34
|
>
|
|
44
|
-
<
|
|
35
|
+
<div className="ml-auto container bg-white flex justify-center shadow-blue-gray">
|
|
36
|
+
{leftItems.map(renderMenuItem(activeItem, close))}
|
|
37
|
+
<StickyBottomMenuBurger isActive={isBurgerMenuDialogOpen} onClick={toggle} />
|
|
38
|
+
{rightItems.map(renderMenuItem(activeItem, close))}
|
|
39
|
+
</div>
|
|
45
40
|
</BlockWrapper>
|
|
46
41
|
</div>
|
|
47
42
|
);
|
|
48
43
|
});
|
|
44
|
+
|
|
45
|
+
const renderMenuItem = (activeItem: MenuItem, close: () => void) => (_: MenuItem, i: number) =>
|
|
46
|
+
(
|
|
47
|
+
<StickyBottomMenuItem
|
|
48
|
+
key={_.href || String(i)}
|
|
49
|
+
isActive={_ === activeItem}
|
|
50
|
+
item={_}
|
|
51
|
+
onClick={close}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
3
|
+
import { style } from '../../utils/style';
|
|
4
|
+
|
|
5
|
+
interface StickyBottomMenuBurgerProps {
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const StickyBottomMenuBurger = JSX<StickyBottomMenuBurgerProps>(({ isActive, onClick }) => (
|
|
11
|
+
<button
|
|
12
|
+
className={style(
|
|
13
|
+
isActive ? 'text-primary-main' : 'text-primary-text',
|
|
14
|
+
`w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`,
|
|
15
|
+
)}
|
|
16
|
+
onClick={onClick}
|
|
17
|
+
>
|
|
18
|
+
<Icon className="w-6 h-6" name="BurgerIcon" iconVersion={isActive ? 'color' : 'black'} />
|
|
19
|
+
Меню
|
|
20
|
+
</button>
|
|
21
|
+
));
|