@gravity-ui/page-constructor 5.21.0 → 5.22.0
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/build/cjs/constructor-items.d.ts +4 -4
- package/build/cjs/models/navigation.d.ts +8 -0
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.css +42 -3
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.d.ts +1 -1
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.js +7 -2
- package/build/cjs/navigation/components/Logo/Logo.d.ts +1 -1
- package/build/cjs/navigation/components/Logo/Logo.js +3 -1
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.d.ts +1 -1
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.js +3 -1
- package/build/cjs/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/cjs/navigation/components/Navigation/Navigation.js +5 -24
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -1
- package/build/cjs/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +5 -5
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +3 -1
- package/build/cjs/navigation/components/Standalone/index.d.ts +2 -2
- package/build/cjs/navigation/containers/Layout/Layout.js +2 -1
- package/build/cjs/navigation/hooks/index.d.ts +2 -0
- package/build/cjs/navigation/hooks/index.js +10 -0
- package/build/cjs/navigation/hooks/useActiveNavItem.d.ts +26 -0
- package/build/cjs/navigation/hooks/useActiveNavItem.js +15 -0
- package/build/cjs/navigation/hooks/useShowBorder.d.ts +2 -0
- package/build/cjs/navigation/hooks/useShowBorder.js +21 -0
- package/build/cjs/navigation/index.d.ts +14 -0
- package/build/cjs/navigation/index.js +16 -4
- package/build/cjs/navigation/models.d.ts +1 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +34 -1
- package/build/esm/constructor-items.d.ts +4 -4
- package/build/esm/models/navigation.d.ts +8 -0
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.css +42 -3
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.d.ts +1 -1
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.js +4 -1
- package/build/esm/navigation/components/Logo/Logo.d.ts +1 -1
- package/build/esm/navigation/components/Logo/Logo.js +1 -1
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.d.ts +1 -1
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.js +1 -1
- package/build/esm/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/esm/navigation/components/Navigation/Navigation.js +6 -25
- package/build/esm/navigation/components/NavigationItem/NavigationItem.d.ts +1 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +1 -1
- package/build/esm/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +5 -5
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.d.ts +1 -1
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/esm/navigation/components/Standalone/index.d.ts +2 -2
- package/build/esm/navigation/containers/Layout/Layout.js +2 -1
- package/build/esm/navigation/hooks/index.d.ts +2 -0
- package/build/esm/navigation/hooks/index.js +2 -0
- package/build/esm/navigation/hooks/useActiveNavItem.d.ts +26 -0
- package/build/esm/navigation/hooks/useActiveNavItem.js +13 -0
- package/build/esm/navigation/hooks/useShowBorder.d.ts +2 -0
- package/build/esm/navigation/hooks/useShowBorder.js +19 -0
- package/build/esm/navigation/index.d.ts +14 -0
- package/build/esm/navigation/index.js +14 -0
- package/build/esm/navigation/models.d.ts +1 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +34 -1
- package/package.json +1 -1
- package/server/models/navigation.d.ts +8 -0
- package/widget/index.js +1 -1
|
@@ -27,18 +27,43 @@ unpredictable css rules order in build */
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
.pc-desktop-navigation__mobile-navigation.pc-desktop-navigation__mobile-navigation {
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
}
|
|
33
|
+
@media (min-width: 769px) {
|
|
34
|
+
.pc-desktop-navigation__mobile-navigation.pc-desktop-navigation__mobile-navigation {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.pc-desktop-navigation__mobile-navigation-container {
|
|
40
|
+
padding-right: 8px;
|
|
41
|
+
}
|
|
42
|
+
.pc-desktop-navigation__mobile-navigation-container:has(.pc-overflow-scroller__arrow) .pc-desktop-navigation__mobile-navigation {
|
|
43
|
+
justify-content: flex-start;
|
|
44
|
+
}
|
|
45
|
+
.pc-desktop-navigation__mobile-navigation-container:has(.pc-overflow-scroller__arrow_type_right) {
|
|
46
|
+
padding-right: 16px;
|
|
47
|
+
}
|
|
30
48
|
.pc-desktop-navigation__right {
|
|
31
|
-
flex: 0;
|
|
32
49
|
justify-content: flex-end;
|
|
33
50
|
font-size: var(--g-text-body-2-font-size);
|
|
34
51
|
line-height: var(--g-text-body-2-line-height);
|
|
35
52
|
}
|
|
36
|
-
|
|
53
|
+
@media (max-width: 768px) {
|
|
54
|
+
.pc-desktop-navigation__right {
|
|
55
|
+
flex: 3 0 0;
|
|
56
|
+
max-width: 50%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.pc-desktop-navigation__navigation-container, .pc-desktop-navigation__mobile-navigation-container {
|
|
37
60
|
display: flex;
|
|
38
61
|
overflow-x: hidden;
|
|
39
62
|
flex: 1 0 0;
|
|
40
63
|
justify-content: space-between;
|
|
41
64
|
align-items: center;
|
|
65
|
+
}
|
|
66
|
+
.pc-desktop-navigation__navigation-container {
|
|
42
67
|
margin-right: 32px;
|
|
43
68
|
}
|
|
44
69
|
.pc-desktop-navigation__button {
|
|
@@ -48,7 +73,7 @@ unpredictable css rules order in build */
|
|
|
48
73
|
margin: 0 32px 0 0;
|
|
49
74
|
cursor: pointer;
|
|
50
75
|
}
|
|
51
|
-
.pc-desktop-navigation__buttons, .pc-desktop-
|
|
76
|
+
.pc-desktop-navigation__links, .pc-desktop-navigation__buttons, .pc-desktop-navigation__mobile-buttons {
|
|
52
77
|
display: flex;
|
|
53
78
|
align-items: center;
|
|
54
79
|
margin: 0;
|
|
@@ -63,6 +88,14 @@ unpredictable css rules order in build */
|
|
|
63
88
|
.pc-desktop-navigation__buttons > *:not(:last-child) {
|
|
64
89
|
margin-right: 16px;
|
|
65
90
|
}
|
|
91
|
+
@media (min-width: 769px) {
|
|
92
|
+
.pc-desktop-navigation__mobile-buttons {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
.pc-desktop-navigation__mobile-buttons .pc-desktop-navigation__item:not(:last-child) {
|
|
97
|
+
margin-right: 0;
|
|
98
|
+
}
|
|
66
99
|
.pc-desktop-navigation__links {
|
|
67
100
|
position: relative;
|
|
68
101
|
font-size: var(--g-text-body-2-font-size);
|
|
@@ -78,6 +111,12 @@ unpredictable css rules order in build */
|
|
|
78
111
|
.pc-desktop-navigation__navigation-container {
|
|
79
112
|
justify-content: flex-end;
|
|
80
113
|
}
|
|
114
|
+
.pc-desktop-navigation__navigation-container, .pc-desktop-navigation__mobile-navigation-container {
|
|
115
|
+
justify-content: flex-end;
|
|
116
|
+
}
|
|
117
|
+
.pc-desktop-navigation__navigation-container {
|
|
118
|
+
flex: 0 0 0;
|
|
119
|
+
}
|
|
81
120
|
.pc-desktop-navigation__left {
|
|
82
121
|
flex: 1 0 0;
|
|
83
122
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DesktopNavigationProps } from '../../models';
|
|
3
3
|
import './DesktopNavigation.css';
|
|
4
|
-
declare const DesktopNavigation: React.FC<DesktopNavigationProps>;
|
|
4
|
+
export declare const DesktopNavigation: React.FC<DesktopNavigationProps>;
|
|
5
5
|
export default DesktopNavigation;
|
|
@@ -7,13 +7,16 @@ import { MobileMenuButton } from '../MobileMenuButton/MobileMenuButton';
|
|
|
7
7
|
import { NavigationList } from '../NavigationList/NavigationList';
|
|
8
8
|
import './DesktopNavigation.css';
|
|
9
9
|
const b = block('desktop-navigation');
|
|
10
|
-
const DesktopNavigation = ({ logo, leftItemsWithIconSize, rightItemsWithIconSize, isSidebarOpened, onSidebarOpenedChange, onActiveItemChange, activeItemId, }) => (React.createElement("div", { className: b('wrapper') },
|
|
10
|
+
export const DesktopNavigation = ({ logo, leftItemsWithIconSize, rightItemsWithIconSize, customMobileHeaderItems, isSidebarOpened, onSidebarOpenedChange, onActiveItemChange, activeItemId, }) => (React.createElement("div", { className: b('wrapper') },
|
|
11
11
|
logo && (React.createElement("div", { className: b('left') },
|
|
12
12
|
React.createElement(Logo, Object.assign({}, logo, { className: b('logo') })))),
|
|
13
13
|
React.createElement("div", { className: b('navigation-container') },
|
|
14
14
|
React.createElement(OverflowScroller, { className: b('navigation'), onScrollStart: onActiveItemChange },
|
|
15
15
|
React.createElement(NavigationList, { items: leftItemsWithIconSize, onActiveItemChange: onActiveItemChange, className: b('links'), itemClassName: b('item'), column: ItemColumnName.Left, activeItemId: activeItemId, menuLayout: NavigationLayout.Desktop }))),
|
|
16
16
|
React.createElement("div", { className: b('right') },
|
|
17
|
+
customMobileHeaderItems && (React.createElement("div", { className: b('mobile-navigation-container') },
|
|
18
|
+
React.createElement(OverflowScroller, { className: b('mobile-navigation'), onScrollStart: onActiveItemChange, arrowSize: 18 },
|
|
19
|
+
React.createElement(NavigationList, { items: customMobileHeaderItems, onActiveItemChange: onActiveItemChange, className: b('mobile-buttons'), itemClassName: b('item'), column: ItemColumnName.Left, activeItemId: activeItemId, menuLayout: NavigationLayout.Dropdown })))),
|
|
17
20
|
React.createElement(MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
18
21
|
rightItemsWithIconSize && (React.createElement(NavigationList, { onActiveItemChange: onActiveItemChange, column: ItemColumnName.Right, items: rightItemsWithIconSize, activeItemId: activeItemId, className: b('buttons'), itemClassName: b('item'), menuLayout: NavigationLayout.Desktop })))));
|
|
19
22
|
export default DesktopNavigation;
|
|
@@ -9,7 +9,7 @@ import { block, getLinkProps, getThemedValue } from '../../../utils';
|
|
|
9
9
|
import { i18n } from './i18n';
|
|
10
10
|
import './Logo.css';
|
|
11
11
|
const b = block('logo');
|
|
12
|
-
const Logo = (_a) => {
|
|
12
|
+
export const Logo = (_a) => {
|
|
13
13
|
var { alt = i18n('image-alt') } = _a, restProps = __rest(_a, ["alt"]);
|
|
14
14
|
const props = Object.assign(Object.assign({}, restProps), { alt });
|
|
15
15
|
const { hostname, Link } = useContext(LocationContext);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MobileNavigationProps } from '../../models';
|
|
3
3
|
import './MobileNavigation.css';
|
|
4
|
-
declare const MobileNavigation: React.FC<MobileNavigationProps>;
|
|
4
|
+
export declare const MobileNavigation: React.FC<MobileNavigationProps>;
|
|
5
5
|
export default MobileNavigation;
|
|
@@ -8,7 +8,7 @@ import { ItemColumnName, NavigationLayout } from '../../models';
|
|
|
8
8
|
import { NavigationList } from '../NavigationList/NavigationList';
|
|
9
9
|
import './MobileNavigation.css';
|
|
10
10
|
const b = block('mobile-navigation');
|
|
11
|
-
const MobileNavigation = (_a) => {
|
|
11
|
+
export const MobileNavigation = (_a) => {
|
|
12
12
|
var { isOpened, topItems, bottomItems } = _a, props = __rest(_a, ["isOpened", "topItems", "bottomItems"]);
|
|
13
13
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
14
14
|
useMount(() => setIsMounted(true));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ClassNameProps, HeaderData, ThemedNavigationLogoData } from '../../../models';
|
|
3
3
|
import './Navigation.css';
|
|
4
|
-
export interface
|
|
4
|
+
export interface NavigationComponentProps extends ClassNameProps {
|
|
5
5
|
logo: ThemedNavigationLogoData;
|
|
6
6
|
data: HeaderData;
|
|
7
7
|
}
|
|
8
|
-
export declare const Navigation: React.FC<
|
|
8
|
+
export declare const Navigation: React.FC<NavigationComponentProps>;
|
|
9
9
|
export default Navigation;
|
|
@@ -1,42 +1,23 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import debounce from 'lodash/debounce';
|
|
1
|
+
import React, { useState } from 'react';
|
|
3
2
|
import OutsideClick from '../../../components/OutsideClick/OutsideClick';
|
|
4
3
|
import { Col, Grid, Row } from '../../../grid';
|
|
5
4
|
import { block } from '../../../utils';
|
|
6
|
-
import {
|
|
5
|
+
import { useActiveNavItem, useShowBorder } from '../../hooks';
|
|
7
6
|
import DesktopNavigation from '../DesktopNavigation/DesktopNavigation';
|
|
8
7
|
import MobileNavigation from '../MobileNavigation/MobileNavigation';
|
|
9
8
|
import './Navigation.css';
|
|
10
9
|
const b = block('navigation');
|
|
11
10
|
export const Navigation = ({ data, logo, className }) => {
|
|
12
|
-
const { leftItems, rightItems, iconSize = 20, withBorder = false, withBorderOnScroll = true, } = data;
|
|
11
|
+
const { leftItems, rightItems, customMobileHeaderItems, iconSize = 20, withBorder = false, withBorderOnScroll = true, } = data;
|
|
13
12
|
const [isSidebarOpened, setIsSidebarOpened] = useState(false);
|
|
14
|
-
const [
|
|
15
|
-
const
|
|
16
|
-
const getNavigationItem = getNavigationItemWithIconSize(iconSize);
|
|
17
|
-
const leftItemsWithIconSize = useMemo(() => leftItems.map(getNavigationItem), [getNavigationItem, leftItems]);
|
|
18
|
-
const rightItemsWithIconSize = useMemo(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItem), [getNavigationItem, rightItems]);
|
|
19
|
-
const onActiveItemChange = (id) => {
|
|
20
|
-
setActiveItemId(id);
|
|
21
|
-
};
|
|
13
|
+
const [showBorder] = useShowBorder(withBorder, withBorderOnScroll);
|
|
14
|
+
const { activeItemId, leftItemsWithIconSize, rightItemsWithIconSize, onActiveItemChange } = useActiveNavItem(iconSize, leftItems, rightItems);
|
|
22
15
|
const onSidebarOpenedChange = (isOpen) => setIsSidebarOpened(isOpen);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (!withBorderOnScroll)
|
|
25
|
-
return () => { };
|
|
26
|
-
const showBorderOnScroll = () => {
|
|
27
|
-
if (!withBorder) {
|
|
28
|
-
setShowBorder(window.scrollY > 0);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const scrollHandler = debounce(showBorderOnScroll, 20);
|
|
32
|
-
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
33
|
-
return () => window.removeEventListener('scroll', scrollHandler);
|
|
34
|
-
});
|
|
35
16
|
return (React.createElement(Grid, { className: b({ 'with-border': showBorder }, className) },
|
|
36
17
|
React.createElement(Row, null,
|
|
37
18
|
React.createElement(Col, null,
|
|
38
19
|
React.createElement("nav", null,
|
|
39
|
-
React.createElement(DesktopNavigation, { logo: logo, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, leftItemsWithIconSize: leftItemsWithIconSize, rightItemsWithIconSize: rightItemsWithIconSize, isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
20
|
+
React.createElement(DesktopNavigation, { logo: logo, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, leftItemsWithIconSize: leftItemsWithIconSize, rightItemsWithIconSize: rightItemsWithIconSize, customMobileHeaderItems: customMobileHeaderItems, isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
40
21
|
React.createElement(OutsideClick, { onOutsideClick: () => onSidebarOpenedChange(false) },
|
|
41
22
|
React.createElement(MobileNavigation, { topItems: leftItemsWithIconSize, bottomItems: rightItemsWithIconSize, isOpened: isSidebarOpened, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange })))))));
|
|
42
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NavigationItemProps } from '../../models';
|
|
3
3
|
import './NavigationItem.css';
|
|
4
|
-
declare const NavigationItem: React.FC<NavigationItemProps>;
|
|
4
|
+
export declare const NavigationItem: React.FC<NavigationItemProps>;
|
|
5
5
|
export default NavigationItem;
|
|
@@ -9,7 +9,7 @@ import './NavigationItem.css';
|
|
|
9
9
|
const b = block('navigation-item');
|
|
10
10
|
const ANALYTICS_ID = 'navigation';
|
|
11
11
|
const nonComplexNavigationItemTypes = NavigationItemTypes.filter((type) => type !== NavigationItemType.Dropdown);
|
|
12
|
-
const NavigationItem = (_a) => {
|
|
12
|
+
export const NavigationItem = (_a) => {
|
|
13
13
|
var { data, className, menuLayout } = _a, props = __rest(_a, ["data", "className", "menuLayout"]);
|
|
14
14
|
const { type = NavigationItemType.Link } = data;
|
|
15
15
|
const navItemMap = useNavigationItemMap();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const useNavigationItemMap: () => {
|
|
2
|
-
button: import("react").FC<Pick<import("
|
|
3
|
-
social: import("react").FC<import("
|
|
4
|
-
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("
|
|
5
|
-
link: import("react").FC<import("
|
|
6
|
-
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("
|
|
2
|
+
button: import("react").FC<Pick<import("../../..").NavigationItemProps, "className"> & import("../../../..").ButtonProps>;
|
|
3
|
+
social: import("react").FC<import("../../..").NavigationSocialItemOwnProps>;
|
|
4
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("../../..").NavigationItemProps & import("../../../..").NavigationDropdownItem) => JSX.Element;
|
|
5
|
+
link: import("react").FC<import("../../..").NavigationItemProps & import("../../../..").NavigationLinkItem>;
|
|
6
|
+
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("../../..").NavigationItemProps & import("../../../..").NavigationGithubButton) => JSX.Element;
|
|
7
7
|
};
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { getItemClickHandler } from '../../utils';
|
|
4
4
|
import NavigationItem from '../NavigationItem';
|
|
5
|
-
const NavigationListItem = (_a) => {
|
|
5
|
+
export const NavigationListItem = (_a) => {
|
|
6
6
|
var { column, index, activeItemId, onActiveItemChange } = _a, props = __rest(_a, ["column", "index", "activeItemId", "onActiveItemChange"]);
|
|
7
7
|
const id = `${column}-${index}`;
|
|
8
8
|
const isActive = id === activeItemId;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Standalone: (props:
|
|
1
|
+
import { NavigationComponentProps } from './../../components/Navigation/Navigation';
|
|
2
|
+
declare const Standalone: (props: NavigationComponentProps) => JSX.Element;
|
|
3
3
|
export default Standalone;
|
|
@@ -4,6 +4,7 @@ import Navigation from '../../components/Navigation/Navigation';
|
|
|
4
4
|
import './Layout.css';
|
|
5
5
|
const b = block('layout');
|
|
6
6
|
const Layout = ({ children, navigation }) => (React.createElement("div", { className: b() },
|
|
7
|
-
navigation &&
|
|
7
|
+
navigation &&
|
|
8
|
+
(navigation.renderNavigation ? (navigation.renderNavigation()) : (React.createElement(Navigation, { data: navigation.header, logo: navigation.logo, className: b('navigation') }))),
|
|
8
9
|
React.createElement("main", { className: b('content') }, children)));
|
|
9
10
|
export default Layout;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NavigationItemModel } from '../../models';
|
|
2
|
+
declare const useActiveNavItem: (iconSize: number, leftItems: NavigationItemModel[], rightItems?: NavigationItemModel[]) => {
|
|
3
|
+
activeItemId: string | undefined;
|
|
4
|
+
leftItemsWithIconSize: (import("../../models").NavigationButtonItem | import("../../models").NavigationDropdownItem | {
|
|
5
|
+
type: import("../../models").NavigationItemType.Link;
|
|
6
|
+
url: string;
|
|
7
|
+
urlTitle?: string | undefined;
|
|
8
|
+
arrow?: boolean | undefined;
|
|
9
|
+
target?: string | undefined;
|
|
10
|
+
text: string;
|
|
11
|
+
icon?: import("../../models").ImageProps | undefined;
|
|
12
|
+
iconSize?: number | undefined;
|
|
13
|
+
})[];
|
|
14
|
+
rightItemsWithIconSize: (import("../../models").NavigationButtonItem | import("../../models").NavigationDropdownItem | {
|
|
15
|
+
type: import("../../models").NavigationItemType.Link;
|
|
16
|
+
url: string;
|
|
17
|
+
urlTitle?: string | undefined;
|
|
18
|
+
arrow?: boolean | undefined;
|
|
19
|
+
target?: string | undefined;
|
|
20
|
+
text: string;
|
|
21
|
+
icon?: import("../../models").ImageProps | undefined;
|
|
22
|
+
iconSize?: number | undefined;
|
|
23
|
+
})[] | undefined;
|
|
24
|
+
onActiveItemChange: (id?: string) => void;
|
|
25
|
+
};
|
|
26
|
+
export default useActiveNavItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
|
+
import { getNavigationItemWithIconSize } from '../utils';
|
|
3
|
+
const useActiveNavItem = (iconSize, leftItems, rightItems) => {
|
|
4
|
+
const [activeItemId, setActiveItemId] = useState(undefined);
|
|
5
|
+
const getNavigationItem = getNavigationItemWithIconSize(iconSize);
|
|
6
|
+
const leftItemsWithIconSize = useMemo(() => leftItems.map(getNavigationItem), [getNavigationItem, leftItems]);
|
|
7
|
+
const rightItemsWithIconSize = useMemo(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItem), [getNavigationItem, rightItems]);
|
|
8
|
+
const onActiveItemChange = (id) => {
|
|
9
|
+
setActiveItemId(id);
|
|
10
|
+
};
|
|
11
|
+
return { activeItemId, leftItemsWithIconSize, rightItemsWithIconSize, onActiveItemChange };
|
|
12
|
+
};
|
|
13
|
+
export default useActiveNavItem;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { debounce } from 'lodash';
|
|
3
|
+
const useShowBorder = (withBorder, withBorderOnScroll) => {
|
|
4
|
+
const [showBorder, setShowBorder] = useState(withBorder);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!withBorderOnScroll)
|
|
7
|
+
return () => { };
|
|
8
|
+
const showBorderOnScroll = () => {
|
|
9
|
+
if (!withBorder) {
|
|
10
|
+
setShowBorder(window.scrollY > 0);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const scrollHandler = debounce(showBorderOnScroll, 20);
|
|
14
|
+
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
15
|
+
return () => window.removeEventListener('scroll', scrollHandler);
|
|
16
|
+
});
|
|
17
|
+
return [showBorder];
|
|
18
|
+
};
|
|
19
|
+
export default useShowBorder;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
+
export * from './components/Navigation/Navigation';
|
|
2
|
+
export * from './components/DesktopNavigation/DesktopNavigation';
|
|
3
|
+
export * from './components/MobileNavigation/MobileNavigation';
|
|
4
|
+
export * from './components/MobileMenuButton/MobileMenuButton';
|
|
5
|
+
export * from './components/NavigationList/NavigationList';
|
|
6
|
+
export * from './components/NavigationListItem/NavigationListItem';
|
|
7
|
+
export * from './components/NavigationItem/';
|
|
8
|
+
export * from './components/NavigationItem/NavigationItem';
|
|
9
|
+
export * from './components/NavigationPopup/NavigationPopup';
|
|
10
|
+
export * from './components/SocialIcon/SocialIcon';
|
|
11
|
+
export * from './components/Logo/Logo';
|
|
12
|
+
export * from './hooks';
|
|
13
|
+
export * from './models';
|
|
14
|
+
export * from './utils';
|
|
1
15
|
export { default as Navigation } from './components/Standalone';
|
|
@@ -1 +1,15 @@
|
|
|
1
|
+
export * from './components/Navigation/Navigation';
|
|
2
|
+
export * from './components/DesktopNavigation/DesktopNavigation';
|
|
3
|
+
export * from './components/MobileNavigation/MobileNavigation';
|
|
4
|
+
export * from './components/MobileMenuButton/MobileMenuButton';
|
|
5
|
+
export * from './components/NavigationList/NavigationList';
|
|
6
|
+
export * from './components/NavigationListItem/NavigationListItem';
|
|
7
|
+
export * from './components/NavigationItem/';
|
|
8
|
+
export * from './components/NavigationItem/NavigationItem';
|
|
9
|
+
export * from './components/NavigationPopup/NavigationPopup';
|
|
10
|
+
export * from './components/SocialIcon/SocialIcon';
|
|
11
|
+
export * from './components/Logo/Logo';
|
|
12
|
+
export * from './hooks';
|
|
13
|
+
export * from './models';
|
|
14
|
+
export * from './utils';
|
|
1
15
|
export { default as Navigation } from './components/Standalone';
|
|
@@ -44,6 +44,7 @@ export interface DesktopNavigationProps extends MobileMenuButtonProps, ActiveIte
|
|
|
44
44
|
logo: ThemedNavigationLogoData;
|
|
45
45
|
leftItemsWithIconSize: NavigationItemModel[];
|
|
46
46
|
rightItemsWithIconSize?: NavigationItemModel[];
|
|
47
|
+
customMobileHeaderItems?: NavigationItemModel[];
|
|
47
48
|
}
|
|
48
49
|
export interface MobileNavigationProps extends ClassNameProps, ActiveItemProps {
|
|
49
50
|
isOpened?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-image-card_border_shadow {
|
|
1
|
+
a.pc-image-card_border_shadow, .pc-image-card_border_shadow {
|
|
2
2
|
box-shadow: 0px 4px 24px var(--pc-color-sfx-shadow), 0px 2px 8px var(--pc-color-sfx-shadow);
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -58,4 +58,37 @@ unpredictable css rules order in build */
|
|
|
58
58
|
}
|
|
59
59
|
.pc-image-card_with-content.pc-image-card_direction_reverse .pc-image-card__content {
|
|
60
60
|
padding-bottom: 24px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
a.pc-image-card {
|
|
64
|
+
color: inherit;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
min-height: 248px;
|
|
67
|
+
height: 100%;
|
|
68
|
+
overflow-x: hidden;
|
|
69
|
+
border-radius: var(--pc-border-radius);
|
|
70
|
+
background-color: var(--g-color-base-float);
|
|
71
|
+
transition: box-shadow 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
|
|
72
|
+
}
|
|
73
|
+
a.pc-image-card:hover, a.pc-image-card:active {
|
|
74
|
+
--pc-text-header-color: inherit;
|
|
75
|
+
color: inherit;
|
|
76
|
+
}
|
|
77
|
+
a.pc-image-card_border_line {
|
|
78
|
+
border: 1px solid var(--g-color-line-generic);
|
|
79
|
+
}
|
|
80
|
+
a.pc-image-card_border_line, a.pc-image-card_border_none {
|
|
81
|
+
transition: transform 0.3s ease-out;
|
|
82
|
+
}
|
|
83
|
+
a.pc-image-card_border_line:hover, a.pc-image-card_border_none:hover {
|
|
84
|
+
transform: translateY(-8px);
|
|
85
|
+
}
|
|
86
|
+
a.pc-image-card_border_shadow {
|
|
87
|
+
transition: transform 0.3s ease-out;
|
|
88
|
+
}
|
|
89
|
+
a.pc-image-card_border_shadow:hover {
|
|
90
|
+
transform: translateY(-8px);
|
|
91
|
+
}
|
|
92
|
+
a.pc-image-card_border_shadow:hover {
|
|
93
|
+
background-color: var(--pc-color-base-float-hover);
|
|
61
94
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ThemeSupporting } from '../utils';
|
|
2
3
|
import { ButtonProps, ImageProps } from './constructor-items';
|
|
3
4
|
export declare enum NavigationItemType {
|
|
@@ -69,6 +70,12 @@ export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<Navi
|
|
|
69
70
|
export interface HeaderData {
|
|
70
71
|
leftItems: NavigationItemModel[];
|
|
71
72
|
rightItems?: NavigationItemModel[];
|
|
73
|
+
/**
|
|
74
|
+
* Items for the navigation header on mobile devices.
|
|
75
|
+
* They are located to the right of the Logo and to the left of the MobileMenuButton.
|
|
76
|
+
* @type {NavigationItemModel[]}
|
|
77
|
+
*/
|
|
78
|
+
customMobileHeaderItems?: NavigationItemModel[];
|
|
72
79
|
iconSize?: number;
|
|
73
80
|
withBorder?: boolean;
|
|
74
81
|
withBorderOnScroll?: boolean;
|
|
@@ -90,4 +97,5 @@ export interface NavigationData {
|
|
|
90
97
|
logo: ThemedNavigationLogoData;
|
|
91
98
|
header: HeaderData;
|
|
92
99
|
footer?: FooterData;
|
|
100
|
+
renderNavigation?: () => React.ReactNode;
|
|
93
101
|
}
|