@gravity-ui/page-constructor 1.7.0-alpha.7 → 1.7.0-alpha.8
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/README.md +58 -36
- package/build/cjs/blocks/Tabs/Tabs.css +23 -49
- package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +27 -29
- package/build/cjs/components/Image/Image.js +1 -3
- package/build/cjs/components/OverflowScroller/OverflowScroller.css +2 -0
- package/build/cjs/components/RouterLink/RouterLink.d.ts +1 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +1 -1
- package/build/cjs/components/index.d.ts +2 -0
- package/build/cjs/components/index.js +40 -39
- package/build/cjs/components/navigation/components/Header/Header.css +85 -0
- package/build/cjs/components/navigation/components/Header/Header.d.ts +8 -0
- package/build/cjs/components/navigation/components/Header/Header.js +51 -0
- package/build/cjs/components/navigation/components/Logo/Logo.css +23 -0
- package/build/cjs/components/navigation/components/Logo/Logo.d.ts +7 -0
- package/build/cjs/components/navigation/components/Logo/Logo.js +17 -0
- package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
- package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +13 -0
- package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.js +45 -0
- package/build/cjs/components/navigation/components/Navigation/Navigation.css +43 -0
- package/build/cjs/components/navigation/components/Navigation/Navigation.d.ts +18 -0
- package/build/cjs/components/navigation/components/Navigation/Navigation.js +71 -0
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.css +41 -0
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.d.ts +12 -0
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +60 -0
- package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
- package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +10 -0
- package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.js +45 -0
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.d.ts +7 -0
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +14 -0
- package/build/cjs/components/navigation/components/index.d.ts +7 -0
- package/build/cjs/components/navigation/components/index.js +20 -0
- package/build/cjs/components/navigation/containers/Layout/Layout.css +10 -0
- package/build/cjs/components/navigation/containers/Layout/Layout.d.ts +7 -0
- package/build/cjs/components/navigation/containers/Layout/Layout.js +11 -0
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +3 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.js +12 -10
- package/build/cjs/context/locationContext/locationContext.d.ts +1 -0
- package/build/cjs/icons/NavigationArrow.d.ts +2 -0
- package/build/cjs/icons/NavigationArrow.js +9 -0
- package/build/cjs/icons/NavigationClose.d.ts +2 -0
- package/build/cjs/icons/NavigationClose.js +9 -0
- package/build/cjs/icons/NavigationOpen.d.ts +2 -0
- package/build/cjs/icons/NavigationOpen.js +11 -0
- package/build/cjs/icons/index.d.ts +3 -0
- package/build/cjs/icons/index.js +3 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -7
- package/build/cjs/models/index.d.ts +1 -0
- package/build/cjs/models/index.js +1 -0
- package/build/cjs/models/navigation.d.ts +60 -0
- package/build/cjs/models/navigation.js +10 -0
- package/build/cjs/text-transform/blocks.js +4 -11
- package/build/cjs/text-transform/utils.js +1 -1
- package/build/esm/blocks/Tabs/Tabs.css +23 -49
- package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +27 -29
- package/build/esm/components/Image/Image.d.ts +0 -1
- package/build/esm/components/Image/Image.js +1 -4
- package/build/esm/components/OverflowScroller/OverflowScroller.css +2 -0
- package/build/esm/components/RouterLink/RouterLink.d.ts +1 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +1 -1
- package/build/esm/components/index.d.ts +2 -0
- package/build/esm/components/index.js +2 -0
- package/build/esm/components/navigation/components/Header/Header.css +85 -0
- package/build/esm/components/navigation/components/Header/Header.d.ts +9 -0
- package/build/esm/components/navigation/components/Header/Header.js +47 -0
- package/build/esm/components/navigation/components/Logo/Logo.css +23 -0
- package/build/esm/components/navigation/components/Logo/Logo.d.ts +8 -0
- package/build/esm/components/navigation/components/Logo/Logo.js +15 -0
- package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
- package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +14 -0
- package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.js +43 -0
- package/build/esm/components/navigation/components/Navigation/Navigation.css +43 -0
- package/build/esm/components/navigation/components/Navigation/Navigation.d.ts +19 -0
- package/build/esm/components/navigation/components/Navigation/Navigation.js +70 -0
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.css +41 -0
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.d.ts +13 -0
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +59 -0
- package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
- package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +11 -0
- package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.js +41 -0
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.d.ts +8 -0
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +12 -0
- package/build/esm/components/navigation/components/index.d.ts +7 -0
- package/build/esm/components/navigation/components/index.js +7 -0
- package/build/esm/components/navigation/containers/Layout/Layout.css +10 -0
- package/build/esm/components/navigation/containers/Layout/Layout.d.ts +8 -0
- package/build/esm/components/navigation/containers/Layout/Layout.js +9 -0
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/containers/PageConstructor/PageConstructor.d.ts +3 -2
- package/build/esm/containers/PageConstructor/PageConstructor.js +12 -10
- package/build/esm/context/locationContext/locationContext.d.ts +1 -0
- package/build/esm/icons/NavigationArrow.d.ts +2 -0
- package/build/esm/icons/NavigationArrow.js +4 -0
- package/build/esm/icons/NavigationClose.d.ts +2 -0
- package/build/esm/icons/NavigationClose.js +4 -0
- package/build/esm/icons/NavigationOpen.d.ts +2 -0
- package/build/esm/icons/NavigationOpen.js +6 -0
- package/build/esm/icons/index.d.ts +3 -0
- package/build/esm/icons/index.js +3 -0
- package/build/esm/models/constructor-items/blocks.d.ts +4 -7
- package/build/esm/models/index.d.ts +1 -0
- package/build/esm/models/index.js +1 -0
- package/build/esm/models/navigation.d.ts +60 -0
- package/build/esm/models/navigation.js +7 -0
- package/build/esm/text-transform/blocks.js +4 -11
- package/build/esm/text-transform/utils.js +1 -1
- package/package.json +1 -4
- package/server/models/constructor-items/blocks.d.ts +4 -7
- package/server/models/index.d.ts +1 -0
- package/server/models/index.js +1 -0
- package/server/models/navigation.d.ts +60 -0
- package/server/models/navigation.js +10 -0
- package/server/text-transform/blocks.js +4 -11
- package/server/text-transform/utils.js +1 -1
- package/styles/mixins.scss +38 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.css +0 -12
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +0 -13
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +0 -27
- package/build/cjs/components/Image/Image.css +0 -3
- package/build/esm/components/ButtonTabs/ButtonTabs.css +0 -12
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +0 -14
- package/build/esm/components/ButtonTabs/ButtonTabs.js +0 -25
- package/build/esm/components/Image/Image.css +0 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
7
|
+
const grid_1 = require("../../../../grid");
|
|
8
|
+
const OutsideClick_1 = (0, tslib_1.__importDefault)(require("../../../OutsideClick/OutsideClick"));
|
|
9
|
+
const Control_1 = (0, tslib_1.__importDefault)(require("../../../Control/Control"));
|
|
10
|
+
const Navigation_1 = (0, tslib_1.__importDefault)(require("../Navigation/Navigation"));
|
|
11
|
+
const MobileNavigation_1 = (0, tslib_1.__importDefault)(require("../MobileNavigation/MobileNavigation"));
|
|
12
|
+
const NavigationItem_1 = (0, tslib_1.__importDefault)(require("../NavigationItem/NavigationItem"));
|
|
13
|
+
const Logo_1 = (0, tslib_1.__importDefault)(require("../Logo/Logo"));
|
|
14
|
+
const icons_1 = require("../../../../icons");
|
|
15
|
+
const b = (0, bem_cn_lite_1.default)('header');
|
|
16
|
+
const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
|
|
17
|
+
const iconProps = { icon: isSidebarOpened ? icons_1.NavigationClose : icons_1.NavigationOpen, iconSize: 36 };
|
|
18
|
+
return (react_1.default.createElement(Control_1.default, Object.assign({ className: b('mobile-menu-button'), onClick: (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
onSidebarOpenedChange(!isSidebarOpened);
|
|
21
|
+
}, size: "l" }, iconProps)));
|
|
22
|
+
};
|
|
23
|
+
const Header = ({ data, logo }) => {
|
|
24
|
+
const { leftItems, rightItems } = data;
|
|
25
|
+
const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
|
|
26
|
+
const [activeItemIndex, setActiveItemIndex] = (0, react_1.useState)(-1);
|
|
27
|
+
const onActiveItemChange = (0, react_1.useCallback)((index) => {
|
|
28
|
+
setActiveItemIndex(index);
|
|
29
|
+
}, []);
|
|
30
|
+
const onSidebarOpenedChange = (0, react_1.useCallback)((isOpen) => {
|
|
31
|
+
setIsSidebarOpened(isOpen);
|
|
32
|
+
}, []);
|
|
33
|
+
const hideSidebar = (0, react_1.useCallback)(() => {
|
|
34
|
+
setIsSidebarOpened(false);
|
|
35
|
+
}, []);
|
|
36
|
+
return (react_1.default.createElement(grid_1.Grid, { className: b() },
|
|
37
|
+
react_1.default.createElement(grid_1.Row, null,
|
|
38
|
+
react_1.default.createElement(grid_1.Col, null,
|
|
39
|
+
react_1.default.createElement("header", { className: b('wrapper') },
|
|
40
|
+
logo && (react_1.default.createElement("div", { className: b('left') },
|
|
41
|
+
react_1.default.createElement(Logo_1.default, Object.assign({}, logo, { className: b('logo') })))),
|
|
42
|
+
react_1.default.createElement("div", { className: b('navigation-container') },
|
|
43
|
+
react_1.default.createElement(Navigation_1.default, { className: b('navigation'), links: leftItems, activeItemIndex: activeItemIndex, onActiveItemChange: onActiveItemChange })),
|
|
44
|
+
react_1.default.createElement("div", { className: b('right') },
|
|
45
|
+
react_1.default.createElement(MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
46
|
+
rightItems && (react_1.default.createElement("div", { className: b('buttons') }, rightItems.map((button) => (react_1.default.createElement(NavigationItem_1.default, { key: button.text, data: button, className: b('button') })))))),
|
|
47
|
+
react_1.default.createElement(OutsideClick_1.default, { onOutsideClick: () => onSidebarOpenedChange(false) },
|
|
48
|
+
react_1.default.createElement(MobileNavigation_1.default, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemIndex: activeItemIndex, onActiveItemChange: onActiveItemChange, onClose: hideSidebar })))))));
|
|
49
|
+
};
|
|
50
|
+
exports.Header = Header;
|
|
51
|
+
exports.default = exports.Header;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.logo {
|
|
2
|
+
margin: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* use this for style redefinitions to awoid problems with
|
|
6
|
+
unpredictable css rules order in build */
|
|
7
|
+
.logo {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
font-weight: var(--yc-text-accent-font-weight);
|
|
11
|
+
font-size: var(--yc-text-header-1-font-size);
|
|
12
|
+
line-height: var(--yc-text-header-1-line-height);
|
|
13
|
+
color: var(--pc-text-header-color);
|
|
14
|
+
font-weight: var(--yc-text-accent-font-weight);
|
|
15
|
+
}
|
|
16
|
+
.logo__icon {
|
|
17
|
+
display: flex;
|
|
18
|
+
margin-right: 8px;
|
|
19
|
+
object-fit: contain;
|
|
20
|
+
}
|
|
21
|
+
.logo__text {
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
5
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
6
|
+
const RouterLink_1 = (0, tslib_1.__importDefault)(require("../../../RouterLink/RouterLink"));
|
|
7
|
+
const utils_1 = require("../../../Media/Image/utils");
|
|
8
|
+
const index_1 = require("../../../index");
|
|
9
|
+
const b = (0, bem_cn_lite_1.default)('logo');
|
|
10
|
+
const Logo = ({ icon, text, className }) => {
|
|
11
|
+
const imageData = (0, utils_1.getMediaImage)(icon);
|
|
12
|
+
return (react_1.default.createElement(RouterLink_1.default, { href: "/", passHref: true },
|
|
13
|
+
react_1.default.createElement("div", { className: b(null, className) },
|
|
14
|
+
imageData && react_1.default.createElement(index_1.Image, Object.assign({ className: b('icon') }, imageData)),
|
|
15
|
+
react_1.default.createElement("span", { className: b('text') }, text))));
|
|
16
|
+
};
|
|
17
|
+
exports.default = Logo;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.mobile-navigation {
|
|
4
|
+
position: fixed;
|
|
5
|
+
z-index: 100;
|
|
6
|
+
top: var(--header-height);
|
|
7
|
+
left: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
border-bottom-right-radius: var(--pc-border-radius);
|
|
10
|
+
border-bottom-left-radius: var(--pc-border-radius);
|
|
11
|
+
background-color: var(--yc-color-base-background);
|
|
12
|
+
box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
|
|
13
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
14
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
15
|
+
}
|
|
16
|
+
@media (min-width: 769px) {
|
|
17
|
+
.mobile-navigation {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.mobile-navigation__wrapper {
|
|
22
|
+
padding: 32px 20px;
|
|
23
|
+
}
|
|
24
|
+
.mobile-navigation__button {
|
|
25
|
+
margin-top: 24px;
|
|
26
|
+
}
|
|
27
|
+
.mobile-navigation__links {
|
|
28
|
+
position: relative;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
padding-bottom: 24px;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
list-style: none;
|
|
35
|
+
}
|
|
36
|
+
.mobile-navigation__links-item:not(:last-child) {
|
|
37
|
+
margin-bottom: 24px;
|
|
38
|
+
}
|
|
39
|
+
.mobile-navigation__dropdown-item:not(:last-child) {
|
|
40
|
+
margin-bottom: 16px;
|
|
41
|
+
}
|
|
42
|
+
.mobile-navigation__popup {
|
|
43
|
+
z-index: 101;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
min-width: 220px;
|
|
47
|
+
padding: 16px;
|
|
48
|
+
border: 1px solid var(--yc-color-line-generic);
|
|
49
|
+
border-top-width: 0;
|
|
50
|
+
border-radius: calc(var(--pc-border-radius) / 2);
|
|
51
|
+
background: var(--yc-color-base-float);
|
|
52
|
+
box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
|
|
53
|
+
}
|
|
54
|
+
@media (min-width: 769px) {
|
|
55
|
+
.mobile-navigation__popup {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigationItem as NavigationItemModel } from '../../../../models/navigation';
|
|
3
|
+
export interface MobileNavigationProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
isOpened?: boolean;
|
|
6
|
+
topItems?: NavigationItemModel[];
|
|
7
|
+
bottomItems?: NavigationItemModel[];
|
|
8
|
+
activeItemIndex: number;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onActiveItemChange: (index: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const MobileNavigation: React.FC<MobileNavigationProps>;
|
|
13
|
+
export default MobileNavigation;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const Foldable_1 = (0, tslib_1.__importDefault)(require("../../../Foldable/Foldable"));
|
|
8
|
+
const navigation_1 = require("../../../../models/navigation");
|
|
9
|
+
const NavigationItem_1 = (0, tslib_1.__importDefault)(require("../NavigationItem/NavigationItem"));
|
|
10
|
+
const b = (0, bem_cn_lite_1.default)('mobile-navigation');
|
|
11
|
+
const MobileNavigationDropdown = ({ data, onItemClick, onToggle, isOpened = false, }) => {
|
|
12
|
+
const ref = (0, react_1.useRef)(null);
|
|
13
|
+
return (react_1.default.createElement("div", { ref: ref, className: b('dropdown') },
|
|
14
|
+
react_1.default.createElement(NavigationItem_1.default, { data: data, onClick: onToggle, isOpened: isOpened }),
|
|
15
|
+
isOpened && (react_1.default.createElement(uikit_1.Popup, { anchorRef: ref, open: isOpened, className: b('popup') }, data.items.map((item) => (react_1.default.createElement(NavigationItem_1.default, { key: item.text, data: item, className: b('dropdown-item'), onClick: onItemClick })))))));
|
|
16
|
+
};
|
|
17
|
+
const MobileNavigationItem = ({ link, index, isActive, onActiveItemChange, onClose, }) => {
|
|
18
|
+
const toggleActive = (0, react_1.useCallback)((e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
if (onActiveItemChange) {
|
|
21
|
+
onActiveItemChange(isActive ? -1 : index);
|
|
22
|
+
}
|
|
23
|
+
}, [isActive, index, onActiveItemChange]);
|
|
24
|
+
const onItemClick = (0, react_1.useCallback)((e) => {
|
|
25
|
+
toggleActive(e);
|
|
26
|
+
onClose();
|
|
27
|
+
}, [toggleActive, onClose]);
|
|
28
|
+
return (react_1.default.createElement("li", { key: index, className: b('links-item') }, link.type === navigation_1.NavigationItemType.Dropdown ? (react_1.default.createElement(MobileNavigationDropdown, { data: link, onToggle: toggleActive, isOpened: isActive, onItemClick: onItemClick })) : (react_1.default.createElement(NavigationItem_1.default, { data: link, onClick: onItemClick }))));
|
|
29
|
+
};
|
|
30
|
+
const MobileNavigation = (props) => {
|
|
31
|
+
if (typeof window === 'undefined') {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const { isOpened, topItems, bottomItems, activeItemIndex, onActiveItemChange, onClose } = props;
|
|
35
|
+
return (react_1.default.createElement(uikit_1.Portal, null,
|
|
36
|
+
react_1.default.createElement(Foldable_1.default, { key: topItems === null || topItems === void 0 ? void 0 : topItems.length, className: b(), isOpened: Boolean(isOpened) },
|
|
37
|
+
react_1.default.createElement("div", { className: b('wrapper') },
|
|
38
|
+
react_1.default.createElement("nav", null,
|
|
39
|
+
react_1.default.createElement("ul", { className: b('links') }, topItems === null || topItems === void 0 ? void 0 : topItems.map((link, index) => {
|
|
40
|
+
const isActive = index === activeItemIndex;
|
|
41
|
+
return (react_1.default.createElement(MobileNavigationItem, { key: index, link: link, index: index, isActive: isOpened && isActive, onClose: onClose, onActiveItemChange: onActiveItemChange }));
|
|
42
|
+
}))), bottomItems === null || bottomItems === void 0 ? void 0 :
|
|
43
|
+
bottomItems.map((item) => (react_1.default.createElement(NavigationItem_1.default, { key: item.text, data: item, className: b('button') })))))));
|
|
44
|
+
};
|
|
45
|
+
exports.default = MobileNavigation;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.navigation {
|
|
4
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
5
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
6
|
+
}
|
|
7
|
+
.navigation__links {
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
list-style: none;
|
|
14
|
+
}
|
|
15
|
+
.navigation__links-item {
|
|
16
|
+
position: relative;
|
|
17
|
+
height: var(--header-height);
|
|
18
|
+
line-height: var(--header-height);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
outline: none;
|
|
21
|
+
color: inherit;
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
}
|
|
24
|
+
.utilityfocus .navigation__links-item:focus {
|
|
25
|
+
outline: 2px solid #ffdb4d;
|
|
26
|
+
}
|
|
27
|
+
.navigation__links-item:hover, .navigation__links-item:active {
|
|
28
|
+
color: var(--yc-color-text-link);
|
|
29
|
+
}
|
|
30
|
+
.navigation__links-item:not(:last-child) {
|
|
31
|
+
margin-right: 20px;
|
|
32
|
+
}
|
|
33
|
+
.navigation__slider-container {
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: 0;
|
|
36
|
+
bottom: 0;
|
|
37
|
+
left: 0;
|
|
38
|
+
}
|
|
39
|
+
.navigation__slider {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 2px;
|
|
42
|
+
background-color: var(--yc-color-text-link);
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { MouseEventHandler } from 'react';
|
|
2
|
+
import { NavigationDropdownItem, NavigationItem as NavigationItemModel } from '../../../../models/navigation';
|
|
3
|
+
export interface NavigationProps {
|
|
4
|
+
links: NavigationItemModel[];
|
|
5
|
+
activeItemIndex: number;
|
|
6
|
+
onActiveItemChange: (index: number) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
highlightActiveItem?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface NavigationDropdownProps {
|
|
11
|
+
data: NavigationDropdownItem;
|
|
12
|
+
onClick: MouseEventHandler;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
position: number;
|
|
15
|
+
hidePopup: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare const Navigation: React.FC<NavigationProps>;
|
|
18
|
+
export default Navigation;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
5
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
6
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
7
|
+
const OverflowScroller_1 = (0, tslib_1.__importDefault)(require("../../../OverflowScroller/OverflowScroller"));
|
|
8
|
+
const navigation_1 = require("../../../../models/navigation");
|
|
9
|
+
const NavigationPopup_1 = (0, tslib_1.__importDefault)(require("../NavigationPopup/NavigationPopup"));
|
|
10
|
+
const NavigationItem_1 = (0, tslib_1.__importDefault)(require("../NavigationItem/NavigationItem"));
|
|
11
|
+
const locationContext_1 = require("../../../../context/locationContext");
|
|
12
|
+
const breakpointContext_1 = require("../../../../context/breakpointContext");
|
|
13
|
+
const b = (0, bem_cn_lite_1.default)('navigation');
|
|
14
|
+
const NavigationDropdown = ({ data, isActive, position, hidePopup, onClick, }) => {
|
|
15
|
+
const { text, items } = data, popupProps = (0, tslib_1.__rest)(data, ["text", "items"]);
|
|
16
|
+
return (react_1.default.createElement(react_1.Fragment, null,
|
|
17
|
+
react_1.default.createElement(NavigationItem_1.default, { className: b('link'), onClick: onClick, isOpened: isActive, data: { text, type: navigation_1.NavigationItemType.Dropdown } }),
|
|
18
|
+
isActive && (react_1.default.createElement(NavigationPopup_1.default, Object.assign({ left: position, onClose: hidePopup, items: items }, popupProps)))));
|
|
19
|
+
};
|
|
20
|
+
const Navigation = ({ className, onActiveItemChange, links, activeItemIndex, highlightActiveItem, }) => {
|
|
21
|
+
const { asPath, pathname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
22
|
+
const breakpoint = (0, react_1.useContext)(breakpointContext_1.BreakpointContext);
|
|
23
|
+
const itemRefs = (0, react_1.useRef)([]);
|
|
24
|
+
const [itemPositions, setItemPosition] = (0, react_1.useState)([]);
|
|
25
|
+
const [lastLeftScroll, setLastLeftScroll] = (0, react_1.useState)(0);
|
|
26
|
+
const hidePopup = (0, react_1.useCallback)(() => {
|
|
27
|
+
onActiveItemChange(-1);
|
|
28
|
+
}, [onActiveItemChange]);
|
|
29
|
+
const getItemClickHandler = (0, react_1.useCallback)((index) => (e) => {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
onActiveItemChange(index === activeItemIndex ? -1 : index);
|
|
32
|
+
}, [activeItemIndex, onActiveItemChange]);
|
|
33
|
+
const calculateItemPositions = (0, react_1.useCallback)(() => {
|
|
34
|
+
if (itemRefs.current.length) {
|
|
35
|
+
const currentItemPositions = itemRefs.current.map((itemRef) => (itemRef && itemRef.getBoundingClientRect().left) || 0);
|
|
36
|
+
setItemPosition(currentItemPositions);
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
const debouncedCalculateItemPositions = lodash_1.default.debounce(calculateItemPositions, 100);
|
|
41
|
+
const calculateOnScroll = lodash_1.default.debounce(() => {
|
|
42
|
+
const curLeftScroll = window.pageXOffset;
|
|
43
|
+
if (curLeftScroll !== lastLeftScroll) {
|
|
44
|
+
setLastLeftScroll(window.pageXOffset);
|
|
45
|
+
calculateItemPositions();
|
|
46
|
+
}
|
|
47
|
+
}, 100);
|
|
48
|
+
calculateItemPositions();
|
|
49
|
+
setLastLeftScroll(window.pageXOffset);
|
|
50
|
+
window.addEventListener('resize', debouncedCalculateItemPositions);
|
|
51
|
+
window.addEventListener('scroll', calculateOnScroll);
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener(`resize`, calculateItemPositions);
|
|
54
|
+
window.removeEventListener('scroll', calculateOnScroll);
|
|
55
|
+
};
|
|
56
|
+
}, [calculateItemPositions, itemRefs, lastLeftScroll]);
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
hidePopup();
|
|
59
|
+
}, [hidePopup, asPath, pathname, breakpoint]);
|
|
60
|
+
return (react_1.default.createElement(OverflowScroller_1.default, { className: b(null, className), onScrollStart: hidePopup, onScrollEnd: calculateItemPositions },
|
|
61
|
+
react_1.default.createElement("nav", null,
|
|
62
|
+
react_1.default.createElement("ul", { className: b('links') }, links.map((link, index) => {
|
|
63
|
+
const isActive = index === activeItemIndex;
|
|
64
|
+
const onClick = getItemClickHandler(index);
|
|
65
|
+
return (react_1.default.createElement("li", { ref: (el) => itemRefs.current.push(el), key: index, className: b('links-item') },
|
|
66
|
+
link.type === navigation_1.NavigationItemType.Dropdown ? (react_1.default.createElement(NavigationDropdown, { data: link, onClick: onClick, isActive: isActive, position: itemPositions[index], hidePopup: hidePopup })) : (react_1.default.createElement(NavigationItem_1.default, { data: link, onClick: onClick })),
|
|
67
|
+
highlightActiveItem && isActive && (react_1.default.createElement("div", { className: b('slider-container') },
|
|
68
|
+
react_1.default.createElement("div", { className: b('slider') })))));
|
|
69
|
+
})))));
|
|
70
|
+
};
|
|
71
|
+
exports.default = Navigation;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.navigation-item {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
.navigation-item_type_link {
|
|
9
|
+
color: var(--yc-color-text-primary);
|
|
10
|
+
color: inherit;
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
outline: none;
|
|
13
|
+
}
|
|
14
|
+
.utilityfocus .navigation-item_type_link:focus {
|
|
15
|
+
outline: 2px solid #ffdb4d;
|
|
16
|
+
}
|
|
17
|
+
.navigation-item_type_link:hover, .navigation-item_type_link_active {
|
|
18
|
+
color: var(--yc-color-text-link);
|
|
19
|
+
}
|
|
20
|
+
.navigation-item_type_button {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
}
|
|
23
|
+
.navigation-item__arrow {
|
|
24
|
+
position: relative;
|
|
25
|
+
top: -2px;
|
|
26
|
+
width: 9px;
|
|
27
|
+
height: 9px;
|
|
28
|
+
margin-left: 5px;
|
|
29
|
+
}
|
|
30
|
+
.navigation-item__icon {
|
|
31
|
+
display: flex;
|
|
32
|
+
width: 20px;
|
|
33
|
+
height: 20px;
|
|
34
|
+
margin-right: 8px;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
object-fit: cover;
|
|
37
|
+
}
|
|
38
|
+
.navigation-item__dropdown {
|
|
39
|
+
margin-left: 7px;
|
|
40
|
+
color: var(--yc-color-text-secondary);
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { MouseEventHandler } from 'react';
|
|
2
|
+
import { NavigationButtonItem, NavigationDropdownItem, NavigationSocialItem, NavigationLinkItem } from '../../../../models';
|
|
3
|
+
declare type DropdownItemData = Omit<NavigationDropdownItem, 'items'>;
|
|
4
|
+
export declare type NavigationItemData = NavigationLinkItem | NavigationButtonItem | NavigationSocialItem | DropdownItemData;
|
|
5
|
+
export interface NavigationItemProps {
|
|
6
|
+
data: NavigationItemData;
|
|
7
|
+
className?: string;
|
|
8
|
+
onClick?: MouseEventHandler;
|
|
9
|
+
isOpened?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const NavigationItem: React.FC<NavigationItemProps>;
|
|
12
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
5
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
6
|
+
const index_1 = require("../../../index");
|
|
7
|
+
const utils_1 = require("../../../../utils");
|
|
8
|
+
const locationContext_1 = require("../../../../context/locationContext");
|
|
9
|
+
const models_1 = require("../../../../models");
|
|
10
|
+
const icons_1 = require("../../../../icons");
|
|
11
|
+
const SocialIcon_1 = (0, tslib_1.__importDefault)(require("../SocialIcon/SocialIcon"));
|
|
12
|
+
const utils_2 = require("../../../Media/Image/utils");
|
|
13
|
+
const b = (0, bem_cn_lite_1.default)('navigation-item');
|
|
14
|
+
const Content = ({ text, icon }) => (react_1.default.createElement(react_1.Fragment, null,
|
|
15
|
+
icon && react_1.default.createElement(index_1.Image, Object.assign({ className: b('icon') }, icon)),
|
|
16
|
+
react_1.default.createElement("span", { className: b('text') }, text)));
|
|
17
|
+
const NavigationDropdown = (_a) => {
|
|
18
|
+
var { text, icon, isOpened } = _a, props = (0, tslib_1.__rest)(_a, ["text", "icon", "isOpened"]);
|
|
19
|
+
const iconData = icon && (0, utils_2.getMediaImage)(icon);
|
|
20
|
+
return (react_1.default.createElement("span", Object.assign({}, props),
|
|
21
|
+
react_1.default.createElement(Content, { text: text, icon: iconData }),
|
|
22
|
+
react_1.default.createElement(index_1.ToggleArrow, { className: b('dropdown'), size: 12, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
23
|
+
};
|
|
24
|
+
const NavigationLink = (props) => {
|
|
25
|
+
const { hostname, Link } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
26
|
+
const { url, text, icon, arrow, target } = props, rest = (0, tslib_1.__rest)(props, ["url", "text", "icon", "arrow", "target"]);
|
|
27
|
+
const linkExtraProps = (0, utils_1.getLinkProps)(url, hostname, target);
|
|
28
|
+
const iconData = icon && (0, utils_2.getMediaImage)(icon);
|
|
29
|
+
const content = (react_1.default.createElement(react_1.Fragment, null,
|
|
30
|
+
react_1.default.createElement(Content, { text: text, icon: iconData }),
|
|
31
|
+
arrow && react_1.default.createElement(icons_1.NavigationArrow, { className: b('arrow') })));
|
|
32
|
+
if ((linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) || !Link) {
|
|
33
|
+
return (react_1.default.createElement("a", Object.assign({ href: url, title: text }, rest, linkExtraProps), content));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return (react_1.default.createElement(index_1.RouterLink, { href: url, passHref: true },
|
|
37
|
+
react_1.default.createElement("a", Object.assign({}, rest), content)));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const NavigationButton = (props) => {
|
|
41
|
+
const { url, target } = props;
|
|
42
|
+
return target ? (react_1.default.createElement(index_1.Button, Object.assign({}, props, { url: url }))) : (react_1.default.createElement(index_1.RouterLink, { href: url },
|
|
43
|
+
react_1.default.createElement(index_1.Button, Object.assign({}, props, { url: url }))));
|
|
44
|
+
};
|
|
45
|
+
//todo: add types support form component in map
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
const NavigationItemsMap = {
|
|
48
|
+
[models_1.NavigationItemType.Button]: NavigationButton,
|
|
49
|
+
[models_1.NavigationItemType.Social]: SocialIcon_1.default,
|
|
50
|
+
[models_1.NavigationItemType.Dropdown]: NavigationDropdown,
|
|
51
|
+
[models_1.NavigationItemType.Link]: NavigationLink,
|
|
52
|
+
};
|
|
53
|
+
const NavigationItem = (_a) => {
|
|
54
|
+
var { data, className } = _a, props = (0, tslib_1.__rest)(_a, ["data", "className"]);
|
|
55
|
+
const { type = models_1.NavigationItemType.Link } = data;
|
|
56
|
+
const Component = NavigationItemsMap[type];
|
|
57
|
+
const componentProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({ className: b({ type }, className) }, data), props)), [className, data, props, type]);
|
|
58
|
+
return react_1.default.createElement(Component, Object.assign({}, componentProps));
|
|
59
|
+
};
|
|
60
|
+
exports.default = NavigationItem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.navigation-popup {
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: calc(var(--header-height) - 16px);
|
|
6
|
+
padding-right: 4px;
|
|
7
|
+
padding-left: 4px;
|
|
8
|
+
transform: translateX(calc(calc(8px * 2) * -1));
|
|
9
|
+
z-index: 101;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
min-width: 220px;
|
|
13
|
+
padding: 16px;
|
|
14
|
+
border: 1px solid var(--yc-color-line-generic);
|
|
15
|
+
border-top-width: 0;
|
|
16
|
+
border-radius: calc(var(--pc-border-radius) / 2);
|
|
17
|
+
background: var(--yc-color-base-float);
|
|
18
|
+
box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
|
|
19
|
+
}
|
|
20
|
+
@media (max-width: 768px) {
|
|
21
|
+
.navigation-popup {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.navigation-popup__link {
|
|
26
|
+
height: 36px;
|
|
27
|
+
padding: 8px 12px;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
}
|
|
30
|
+
.navigation-popup__link:hover {
|
|
31
|
+
color: var(--yc-color-text-primary);
|
|
32
|
+
background-color: var(--yc-color-base-simple-hover);
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigationLinkItem } from '../../../../models';
|
|
3
|
+
export interface NavigationPopupProps {
|
|
4
|
+
items: NavigationLinkItem[];
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
left?: number;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const NavigationPopup: React.FC<NavigationPopupProps>;
|
|
10
|
+
export default NavigationPopup;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationPopup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
6
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
7
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
8
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
|
+
const index_1 = require("../../../index");
|
|
10
|
+
const NavigationItem_1 = (0, tslib_1.__importDefault)(require("../NavigationItem/NavigationItem"));
|
|
11
|
+
const b = (0, bem_cn_lite_1.default)('navigation-popup');
|
|
12
|
+
const NavigationPopup = ({ items, left, onClose }) => {
|
|
13
|
+
const [calculatedLeft, setCalculatedLeft] = (0, react_1.useState)(left);
|
|
14
|
+
const popupRef = (0, react_1.useRef)(null);
|
|
15
|
+
const calculateLeft = (0, react_1.useCallback)(() => {
|
|
16
|
+
if (popupRef && popupRef.current && left) {
|
|
17
|
+
const right = left + popupRef.current.offsetWidth;
|
|
18
|
+
const docWidth = document.body.clientWidth;
|
|
19
|
+
const currentLeft = right > docWidth ? left - (right - docWidth) : left;
|
|
20
|
+
setCalculatedLeft(currentLeft);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
setCalculatedLeft(left);
|
|
24
|
+
}
|
|
25
|
+
}, [left]);
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
|
+
const debounceCalculateLeft = lodash_1.default.debounce(calculateLeft, 100);
|
|
28
|
+
calculateLeft();
|
|
29
|
+
window.addEventListener('resize', debounceCalculateLeft);
|
|
30
|
+
return () => {
|
|
31
|
+
window.removeEventListener('resize', debounceCalculateLeft);
|
|
32
|
+
};
|
|
33
|
+
}, [calculateLeft]);
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
calculateLeft();
|
|
36
|
+
}, [calculateLeft, left]);
|
|
37
|
+
if (!document || !document.body) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return (react_1.default.createElement(uikit_1.Portal, null,
|
|
41
|
+
react_1.default.createElement("div", { ref: popupRef, className: b(), style: { left: calculatedLeft } },
|
|
42
|
+
react_1.default.createElement(index_1.OutsideClick, { onOutsideClick: onClose }, items.map((item) => (react_1.default.createElement(NavigationItem_1.default, { key: item.text, className: b('link'), data: item })))))));
|
|
43
|
+
};
|
|
44
|
+
exports.NavigationPopup = NavigationPopup;
|
|
45
|
+
exports.default = exports.NavigationPopup;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.social-icon {
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 40px;
|
|
8
|
+
height: 40px;
|
|
9
|
+
margin-right: 8px;
|
|
10
|
+
color: var(--yc-color-base-background);
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
background-color: var(--yc-color-base-generic);
|
|
13
|
+
}
|
|
14
|
+
.social-icon:hover {
|
|
15
|
+
background-color: var(--yc-color-base-generic-hover);
|
|
16
|
+
}
|
|
17
|
+
.social-icon__icon {
|
|
18
|
+
width: 16px;
|
|
19
|
+
height: 16px;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigationSocialItem } from '../../../../models/navigation';
|
|
3
|
+
export interface NavigationSocialItemProps extends NavigationSocialItem {
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SocialIcon: React.FC<NavigationSocialItemProps>;
|
|
7
|
+
export default SocialIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
5
|
+
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
6
|
+
const index_1 = require("../../../index");
|
|
7
|
+
const utils_1 = require("../../../Media/Image/utils");
|
|
8
|
+
const b = (0, bem_cn_lite_1.default)('social-icon');
|
|
9
|
+
const SocialIcon = ({ icon, url, className }) => {
|
|
10
|
+
const iconData = (0, utils_1.getMediaImage)(icon);
|
|
11
|
+
return (react_1.default.createElement("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
|
|
12
|
+
react_1.default.createElement(index_1.Image, Object.assign({ className: b('icon') }, iconData))));
|
|
13
|
+
};
|
|
14
|
+
exports.default = SocialIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Header } from './Header/Header';
|
|
2
|
+
export { default as NavigationItem } from './NavigationItem/NavigationItem';
|
|
3
|
+
export { default as Logo } from './Logo/Logo';
|
|
4
|
+
export { default as MobileNavigation } from './MobileNavigation/MobileNavigation';
|
|
5
|
+
export { default as Navigation } from './Navigation/Navigation';
|
|
6
|
+
export { default as NavigationPopup } from './NavigationPopup/NavigationPopup';
|
|
7
|
+
export { default as SocialIcon } from './SocialIcon/SocialIcon';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SocialIcon = exports.NavigationPopup = exports.Navigation = exports.MobileNavigation = exports.Logo = exports.NavigationItem = exports.Header = void 0;
|
|
7
|
+
var Header_1 = require("./Header/Header");
|
|
8
|
+
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return __importDefault(Header_1).default; } });
|
|
9
|
+
var NavigationItem_1 = require("./NavigationItem/NavigationItem");
|
|
10
|
+
Object.defineProperty(exports, "NavigationItem", { enumerable: true, get: function () { return __importDefault(NavigationItem_1).default; } });
|
|
11
|
+
var Logo_1 = require("./Logo/Logo");
|
|
12
|
+
Object.defineProperty(exports, "Logo", { enumerable: true, get: function () { return __importDefault(Logo_1).default; } });
|
|
13
|
+
var MobileNavigation_1 = require("./MobileNavigation/MobileNavigation");
|
|
14
|
+
Object.defineProperty(exports, "MobileNavigation", { enumerable: true, get: function () { return __importDefault(MobileNavigation_1).default; } });
|
|
15
|
+
var Navigation_1 = require("./Navigation/Navigation");
|
|
16
|
+
Object.defineProperty(exports, "Navigation", { enumerable: true, get: function () { return __importDefault(Navigation_1).default; } });
|
|
17
|
+
var NavigationPopup_1 = require("./NavigationPopup/NavigationPopup");
|
|
18
|
+
Object.defineProperty(exports, "NavigationPopup", { enumerable: true, get: function () { return __importDefault(NavigationPopup_1).default; } });
|
|
19
|
+
var SocialIcon_1 = require("./SocialIcon/SocialIcon");
|
|
20
|
+
Object.defineProperty(exports, "SocialIcon", { enumerable: true, get: function () { return __importDefault(SocialIcon_1).default; } });
|