@gravity-ui/page-constructor 1.7.0-alpha.0 → 1.7.0-alpha.10

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.
Files changed (74) hide show
  1. package/README.md +58 -36
  2. package/build/cjs/components/OverflowScroller/OverflowScroller.css +2 -0
  3. package/build/cjs/components/RouterLink/RouterLink.d.ts +1 -1
  4. package/build/cjs/components/index.d.ts +2 -0
  5. package/build/cjs/components/index.js +40 -39
  6. package/build/cjs/components/navigation/components/Header/Header.css +19 -19
  7. package/build/cjs/components/navigation/components/Header/Header.d.ts +2 -22
  8. package/build/cjs/components/navigation/components/Header/Header.js +40 -70
  9. package/build/cjs/components/navigation/components/Logo/Logo.css +13 -8
  10. package/build/cjs/components/navigation/components/Logo/Logo.d.ts +1 -1
  11. package/build/cjs/components/navigation/components/Logo/Logo.js +11 -7
  12. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.css +17 -11
  13. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.js +3 -3
  14. package/build/cjs/components/navigation/components/Navigation/Navigation.css +8 -8
  15. package/build/cjs/components/navigation/components/Navigation/Navigation.d.ts +9 -2
  16. package/build/cjs/components/navigation/components/Navigation/Navigation.js +18 -19
  17. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.css +9 -9
  18. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.d.ts +1 -3
  19. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +27 -15
  20. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.css +4 -4
  21. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +4 -18
  22. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.js +34 -46
  23. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.css +3 -3
  24. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.d.ts +1 -1
  25. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +8 -4
  26. package/build/cjs/components/navigation/components/index.d.ts +7 -0
  27. package/build/cjs/components/navigation/components/index.js +20 -0
  28. package/build/cjs/components/navigation/containers/Layout/Layout.css +10 -0
  29. package/build/cjs/components/navigation/containers/Layout/Layout.d.ts +8 -0
  30. package/build/cjs/components/navigation/containers/Layout/Layout.js +11 -0
  31. package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +3 -4
  32. package/build/cjs/containers/PageConstructor/PageConstructor.js +11 -11
  33. package/build/cjs/models/index.d.ts +1 -0
  34. package/build/cjs/models/index.js +1 -0
  35. package/build/cjs/models/navigation.d.ts +8 -5
  36. package/build/esm/components/OverflowScroller/OverflowScroller.css +2 -0
  37. package/build/esm/components/RouterLink/RouterLink.d.ts +1 -1
  38. package/build/esm/components/index.d.ts +2 -0
  39. package/build/esm/components/index.js +2 -0
  40. package/build/esm/components/navigation/components/Header/Header.css +19 -19
  41. package/build/esm/components/navigation/components/Header/Header.d.ts +2 -22
  42. package/build/esm/components/navigation/components/Header/Header.js +37 -69
  43. package/build/esm/components/navigation/components/Logo/Logo.css +13 -8
  44. package/build/esm/components/navigation/components/Logo/Logo.d.ts +1 -1
  45. package/build/esm/components/navigation/components/Logo/Logo.js +10 -6
  46. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.css +17 -11
  47. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.js +2 -2
  48. package/build/esm/components/navigation/components/Navigation/Navigation.css +8 -8
  49. package/build/esm/components/navigation/components/Navigation/Navigation.d.ts +9 -2
  50. package/build/esm/components/navigation/components/Navigation/Navigation.js +17 -18
  51. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.css +9 -9
  52. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.d.ts +1 -3
  53. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +23 -11
  54. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.css +4 -4
  55. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +4 -18
  56. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.js +32 -45
  57. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.css +3 -3
  58. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.d.ts +1 -1
  59. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +7 -3
  60. package/build/esm/components/navigation/components/index.d.ts +7 -0
  61. package/build/esm/components/navigation/components/index.js +7 -0
  62. package/build/esm/components/navigation/containers/Layout/Layout.css +10 -0
  63. package/build/esm/components/navigation/containers/Layout/Layout.d.ts +9 -0
  64. package/build/esm/components/navigation/containers/Layout/Layout.js +9 -0
  65. package/build/esm/containers/PageConstructor/PageConstructor.d.ts +3 -4
  66. package/build/esm/containers/PageConstructor/PageConstructor.js +11 -11
  67. package/build/esm/models/index.d.ts +1 -0
  68. package/build/esm/models/index.js +1 -0
  69. package/build/esm/models/navigation.d.ts +8 -5
  70. package/package.json +1 -4
  71. package/server/models/index.d.ts +1 -0
  72. package/server/models/index.js +1 -0
  73. package/server/models/navigation.d.ts +62 -0
  74. package/server/models/navigation.js +10 -0
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageConstructor = exports.Constructor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = (0, tslib_1.__importStar)(require("react"));
6
+ require("@doc-tools/transform/dist/js/yfm");
6
7
  const models_1 = require("../../models");
7
8
  const constructor_items_1 = require("../../constructor-items");
8
9
  const grid_1 = require("../../grid");
@@ -15,8 +16,7 @@ const ConstructorRow_1 = require("./components/ConstructorRow");
15
16
  const ConstructorFootnotes_1 = require("./components/ConstructorFootnotes");
16
17
  const ConstructorItem_1 = require("./components/ConstructorItem");
17
18
  const ConstructorBlocks_1 = require("./components/ConstructorBlocks");
18
- const Header_1 = (0, tslib_1.__importDefault)(require("../../components/navigation/components/Header/Header"));
19
- require("@doc-tools/transform/dist/js/yfm");
19
+ const Layout_1 = (0, tslib_1.__importDefault)(require("../../components/navigation/containers/Layout/Layout"));
20
20
  const b = (0, utils_1.block)('page-constructor');
21
21
  const Constructor = (props) => {
22
22
  const { context, headerBlockTypes } = (0, react_1.useMemo)(() => {
@@ -31,7 +31,7 @@ const Constructor = (props) => {
31
31
  });
32
32
  }, [props.custom]);
33
33
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
34
- const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, navigationData, } = props;
34
+ const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, navigation, } = props;
35
35
  const hasFootnotes = footnotes.length > 0;
36
36
  const isHeaderBlock = (block) => headerBlockTypes.includes(block.type);
37
37
  const header = blocks === null || blocks === void 0 ? void 0 : blocks.find(isHeaderBlock);
@@ -41,14 +41,14 @@ const Constructor = (props) => {
41
41
  react_1.default.createElement("div", { className: b() },
42
42
  react_1.default.createElement("div", { className: b('wrapper') },
43
43
  themedBackground && (react_1.default.createElement(BackgroundMedia_1.default, Object.assign({}, themedBackground, { className: b('background') }))),
44
- (navigationData === null || navigationData === void 0 ? void 0 : navigationData.header) && (react_1.default.createElement(Header_1.default, { logo: navigationData === null || navigationData === void 0 ? void 0 : navigationData.logo, data: navigationData === null || navigationData === void 0 ? void 0 : navigationData.header })),
45
- renderMenu && renderMenu(),
46
- header && react_1.default.createElement(ConstructorItem_1.ConstructorHeader, { data: header }),
47
- react_1.default.createElement(grid_1.Grid, null,
48
- restBlocks && (react_1.default.createElement(ConstructorRow_1.ConstructorRow, null,
49
- react_1.default.createElement(ConstructorBlocks_1.ConstructorBlocks, { items: restBlocks, shouldRenderBlock: shouldRenderBlock }))),
50
- hasFootnotes && (react_1.default.createElement(ConstructorRow_1.ConstructorRow, null,
51
- react_1.default.createElement(ConstructorFootnotes_1.ConstructorFootnotes, { items: footnotes }))))))));
44
+ react_1.default.createElement(Layout_1.default, { navigation: navigation },
45
+ renderMenu && renderMenu(),
46
+ header && react_1.default.createElement(ConstructorItem_1.ConstructorHeader, { data: header }),
47
+ react_1.default.createElement(grid_1.Grid, null,
48
+ restBlocks && (react_1.default.createElement(ConstructorRow_1.ConstructorRow, null,
49
+ react_1.default.createElement(ConstructorBlocks_1.ConstructorBlocks, { items: restBlocks, shouldRenderBlock: shouldRenderBlock }))),
50
+ hasFootnotes && (react_1.default.createElement(ConstructorRow_1.ConstructorRow, null,
51
+ react_1.default.createElement(ConstructorFootnotes_1.ConstructorFootnotes, { items: footnotes })))))))));
52
52
  };
53
53
  exports.Constructor = Constructor;
54
54
  const PageConstructor = (props) => {
@@ -4,3 +4,4 @@ export * from './common';
4
4
  export * from './components';
5
5
  export * from './guards';
6
6
  export * from './react';
7
+ export * from './navigation';
@@ -7,3 +7,4 @@ const tslib_1 = require("tslib");
7
7
  (0, tslib_1.__exportStar)(require("./components"), exports);
8
8
  (0, tslib_1.__exportStar)(require("./guards"), exports);
9
9
  (0, tslib_1.__exportStar)(require("./react"), exports);
10
+ (0, tslib_1.__exportStar)(require("./navigation"), exports);
@@ -1,4 +1,4 @@
1
- import { ButtonProps } from '../components/Button/Button';
1
+ import { ImageProps, ButtonProps } from './constructor-items';
2
2
  export declare enum NavigationItemType {
3
3
  Link = "link",
4
4
  Dropdown = "dropdown",
@@ -7,7 +7,7 @@ export declare enum NavigationItemType {
7
7
  }
8
8
  export interface NavigationItemBase {
9
9
  text: string;
10
- icon?: string;
10
+ icon?: ImageProps;
11
11
  url?: string;
12
12
  }
13
13
  export interface NavigationLinkItem extends NavigationItemBase {
@@ -27,13 +27,16 @@ export interface NavigationDropdownItem extends NavigationItemBase {
27
27
  }
28
28
  export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
29
29
  type: NavigationItemType.Social;
30
- icon: string;
30
+ icon: ImageProps;
31
31
  url: string;
32
32
  }
33
33
  export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
34
- export interface NavigationLogo extends Omit<NavigationItemBase, 'text'> {
35
- icon: string;
34
+ export declare type NavigationItemData = NavigationLinkItem | NavigationButtonItem | NavigationSocialItem | DropdownItemData;
35
+ export declare type DropdownItemData = Omit<NavigationDropdownItem, 'items'>;
36
+ export interface NavigationLogo {
37
+ icon: ImageProps;
36
38
  text?: string;
39
+ url?: string;
37
40
  }
38
41
  export interface HeaderData {
39
42
  leftItems: NavigationItem[];
@@ -9,10 +9,12 @@
9
9
  .pc-overflow-scroller__scroller {
10
10
  position: absolute;
11
11
  z-index: 10;
12
+ top: 0;
12
13
  display: flex;
13
14
  justify-content: flex-end;
14
15
  align-items: center;
15
16
  width: 32px;
17
+ height: calc(100% - 1px);
16
18
  cursor: pointer;
17
19
  color: var(--yc-color-text-secondary);
18
20
  background: linear-gradient(to left, var(--yc-color-base-background) 70%, var(--pc-transparent) 100%) no-repeat;
@@ -1,7 +1,7 @@
1
1
  import { WithChildren } from '../../models';
2
2
  export interface RouterLinkProps {
3
3
  href: string;
4
- [key: string]: any;
4
+ [key: string]: unknown;
5
5
  }
6
6
  declare const RouterLink: ({ href, children }: WithChildren<RouterLinkProps>) => JSX.Element;
7
7
  export default RouterLink;
@@ -33,4 +33,6 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
33
33
  export { default as Author } from './Author/Author';
34
34
  export { default as RouterLink } from './RouterLink/RouterLink';
35
35
  export { default as HTML } from './HTML/HTML';
36
+ export { default as Header } from './navigation/components/Header/Header';
37
+ export * as Navigation from './navigation/components/index';
36
38
  export type { RouterLinkProps } from './RouterLink/RouterLink';
@@ -33,3 +33,5 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
33
33
  export { default as Author } from './Author/Author';
34
34
  export { default as RouterLink } from './RouterLink/RouterLink';
35
35
  export { default as HTML } from './HTML/HTML';
36
+ export { default as Header } from './navigation/components/Header/Header';
37
+ export * as Navigation from './navigation/components/index';
@@ -1,6 +1,6 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
- .header {
3
+ .pc-header {
4
4
  position: sticky;
5
5
  z-index: 98;
6
6
  top: 0;
@@ -9,39 +9,39 @@ unpredictable css rules order in build */
9
9
  align-items: center;
10
10
  height: var(--header-height);
11
11
  background-color: var(--yc-color-base-background);
12
- box-shadow: inset 0px -1px 0px var(--yc-color-line-generic);
12
+ box-shadow: inset 0 -1px 0 var(--yc-color-line-generic);
13
13
  }
14
- .header__wrapper {
14
+ .pc-header__wrapper {
15
15
  display: flex;
16
16
  justify-content: space-between;
17
17
  align-items: center;
18
18
  height: var(--header-height);
19
19
  }
20
20
  @media (min-width: 769px) {
21
- .header__mobile-menu-button {
21
+ .pc-header__mobile-menu-button {
22
22
  display: none;
23
23
  }
24
24
  }
25
- .header__navigation, .header__left, .header__right {
25
+ .pc-header__navigation, .pc-header__left, .pc-header__right {
26
26
  display: flex;
27
27
  align-items: center;
28
28
  }
29
- .header__navigation {
29
+ .pc-header__navigation {
30
30
  position: relative;
31
+ margin-right: 20px;
31
32
  flex: 1 0 0;
32
33
  justify-content: flex-start;
33
- margin-right: 20px;
34
34
  }
35
35
  @media (max-width: 768px) {
36
- .header__navigation {
36
+ .pc-header__navigation {
37
37
  display: none;
38
38
  }
39
39
  }
40
- .header__right {
40
+ .pc-header__right {
41
41
  flex: 0;
42
42
  justify-content: flex-end;
43
43
  }
44
- .header__navigation-container {
44
+ .pc-header__navigation-container {
45
45
  display: flex;
46
46
  overflow-x: hidden;
47
47
  flex: 1 0 0;
@@ -49,37 +49,37 @@ unpredictable css rules order in build */
49
49
  align-items: center;
50
50
  margin-right: 20px;
51
51
  }
52
- .header__buttons {
52
+ .pc-header__buttons {
53
53
  display: flex;
54
54
  }
55
55
  @media (max-width: 768px) {
56
- .header__buttons {
56
+ .pc-header__buttons {
57
57
  display: none;
58
58
  }
59
59
  }
60
- .header__buttons > *:not(:last-child) {
60
+ .pc-header__buttons > *:not(:last-child) {
61
61
  margin-right: 16px;
62
62
  }
63
- .header__button {
63
+ .pc-header__button {
64
64
  margin-top: 0;
65
65
  }
66
- .header__logo {
66
+ .pc-header__logo {
67
67
  margin: 0 32px 0 0;
68
68
  cursor: pointer;
69
69
  }
70
70
  @media (max-width: 768px) {
71
- .header__navigation-container {
71
+ .pc-header__navigation-container {
72
72
  justify-content: flex-end;
73
73
  }
74
- .header__left {
74
+ .pc-header__left {
75
75
  flex: 1 0 0;
76
76
  }
77
77
  }
78
78
  @media (max-width: 576px) {
79
- .header__navigation-container {
79
+ .pc-header__navigation-container {
80
80
  margin-right: 12px;
81
81
  }
82
- .header__logo {
82
+ .pc-header__logo {
83
83
  margin-right: 0;
84
84
  }
85
85
  }
@@ -1,29 +1,9 @@
1
1
  import React from 'react';
2
- import { HeaderData, NavigationLogo } from '../../../../models/navigation';
2
+ import { HeaderData, NavigationLogo } from '../../../../models';
3
3
  import './Header.css';
4
4
  export interface HeaderProps {
5
5
  logo: NavigationLogo;
6
6
  data: HeaderData;
7
7
  }
8
- interface HeaderState {
9
- isSidebarOpened: boolean;
10
- activeItemIndex: number;
11
- }
12
- declare class Header extends React.Component<HeaderProps, HeaderState> {
13
- ref: React.RefObject<unknown>;
14
- state: {
15
- isSidebarOpened: boolean;
16
- activeItemIndex: number;
17
- };
18
- render(): JSX.Element;
19
- private renderLeft;
20
- private renderLogo;
21
- private renderRight;
22
- private renderRightItems;
23
- private renderMobileMenuButton;
24
- private renderMobileNavigation;
25
- private onActiveItemChange;
26
- private onSidebarOpenedChange;
27
- private hideSidebar;
28
- }
8
+ export declare const Header: React.FC<HeaderProps>;
29
9
  export default Header;
@@ -1,79 +1,47 @@
1
- import React, { createRef } from 'react';
2
- import block from 'bem-cn-lite';
1
+ import React, { useCallback, useState } from 'react';
2
+ import { block } from '../../../../utils';
3
3
  import { Col, Grid, Row } from '../../../../grid';
4
4
  import OutsideClick from '../../../OutsideClick/OutsideClick';
5
5
  import Control from '../../../Control/Control';
6
- import Logo from '../Logo/Logo';
7
6
  import Navigation from '../Navigation/Navigation';
8
7
  import MobileNavigation from '../MobileNavigation/MobileNavigation';
9
8
  import NavigationItem from '../NavigationItem/NavigationItem';
9
+ import Logo from '../Logo/Logo';
10
10
  import { NavigationClose, NavigationOpen } from '../../../../icons';
11
11
  import './Header.css';
12
12
  const b = block('header');
13
- class Header extends React.Component {
14
- constructor() {
15
- super(...arguments);
16
- this.ref = createRef();
17
- this.state = {
18
- isSidebarOpened: false,
19
- activeItemIndex: -1,
20
- };
21
- this.onActiveItemChange = (index) => {
22
- this.setState({ activeItemIndex: index });
23
- };
24
- this.onSidebarOpenedChange = (isSidebarOpened) => {
25
- this.setState({ isSidebarOpened });
26
- };
27
- this.hideSidebar = () => {
28
- this.setState({ isSidebarOpened: false });
29
- };
30
- }
31
- render() {
32
- return (React.createElement(Grid, { className: b() },
33
- React.createElement(Row, null,
34
- React.createElement(Col, null,
35
- React.createElement("header", { className: b('wrapper') },
36
- this.renderLogo(),
37
- this.renderLeft(),
38
- this.renderRight(),
39
- this.renderMobileNavigation())))));
40
- }
41
- renderLeft() {
42
- const { activeItemIndex } = this.state;
43
- const { leftItems } = this.props.data;
44
- return (leftItems && (React.createElement("div", { className: b('navigation-container') },
45
- React.createElement(Navigation, { className: b('navigation'), links: leftItems, activeItemIndex: activeItemIndex, onActiveItemChange: this.onActiveItemChange }))));
46
- }
47
- renderLogo() {
48
- const { logo } = this.props;
49
- if (!logo) {
50
- return null;
51
- }
52
- return (React.createElement("div", { className: b('left') },
53
- React.createElement(Logo, Object.assign({}, logo, { className: b('logo') }))));
54
- }
55
- renderRight() {
56
- return (React.createElement("div", { className: b('right') },
57
- this.renderMobileMenuButton(),
58
- this.renderRightItems()));
59
- }
60
- renderRightItems() {
61
- const { rightItems } = this.props.data;
62
- return (rightItems && (React.createElement("div", { className: b('buttons') }, rightItems.map((button) => (React.createElement(NavigationItem, { key: button.text, data: button, className: b('button') }))))));
63
- }
64
- renderMobileMenuButton() {
65
- const { isSidebarOpened } = this.state;
66
- const iconProps = { icon: isSidebarOpened ? NavigationClose : NavigationOpen, iconSize: 36 };
67
- return (React.createElement(Control, Object.assign({ className: b('mobile-menu-button'), onClick: (e) => {
68
- e.stopPropagation();
69
- this.onSidebarOpenedChange(!isSidebarOpened);
70
- }, size: "l" }, iconProps)));
71
- }
72
- renderMobileNavigation() {
73
- const { leftItems, rightItems } = this.props.data;
74
- const { isSidebarOpened, activeItemIndex } = this.state;
75
- return (React.createElement(OutsideClick, { onOutsideClick: () => this.onSidebarOpenedChange(false) },
76
- React.createElement(MobileNavigation, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemIndex: activeItemIndex, onActiveItemChange: this.onActiveItemChange, onClose: this.hideSidebar })));
77
- }
78
- }
13
+ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
14
+ const iconProps = { icon: isSidebarOpened ? NavigationClose : NavigationOpen, iconSize: 36 };
15
+ return (React.createElement(Control, Object.assign({ className: b('mobile-menu-button'), onClick: (e) => {
16
+ e.stopPropagation();
17
+ onSidebarOpenedChange(!isSidebarOpened);
18
+ }, size: "l" }, iconProps)));
19
+ };
20
+ export const Header = ({ data, logo }) => {
21
+ const { leftItems, rightItems } = data;
22
+ const [isSidebarOpened, setIsSidebarOpened] = useState(false);
23
+ const [activeItemIndex, setActiveItemIndex] = useState(-1);
24
+ const onActiveItemChange = useCallback((index) => {
25
+ setActiveItemIndex(index);
26
+ }, []);
27
+ const onSidebarOpenedChange = useCallback((isOpen) => {
28
+ setIsSidebarOpened(isOpen);
29
+ }, []);
30
+ const hideSidebar = useCallback(() => {
31
+ setIsSidebarOpened(false);
32
+ }, []);
33
+ return (React.createElement(Grid, { className: b() },
34
+ React.createElement(Row, null,
35
+ React.createElement(Col, null,
36
+ React.createElement("header", { className: b('wrapper') },
37
+ logo && (React.createElement("div", { className: b('left') },
38
+ React.createElement(Logo, Object.assign({}, logo, { className: b('logo') })))),
39
+ React.createElement("div", { className: b('navigation-container') },
40
+ React.createElement(Navigation, { className: b('navigation'), links: leftItems, activeItemIndex: activeItemIndex, onActiveItemChange: onActiveItemChange })),
41
+ React.createElement("div", { className: b('right') },
42
+ React.createElement(MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
43
+ rightItems && (React.createElement("div", { className: b('buttons') }, rightItems.map((button) => (React.createElement(NavigationItem, { key: button.text, data: button, className: b('button') })))))),
44
+ React.createElement(OutsideClick, { onOutsideClick: () => onSidebarOpenedChange(false) },
45
+ React.createElement(MobileNavigation, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemIndex: activeItemIndex, onActiveItemChange: onActiveItemChange, onClose: hideSidebar })))))));
46
+ };
79
47
  export default Header;
@@ -1,18 +1,23 @@
1
+ .pc-logo {
2
+ margin: 0;
3
+ }
4
+
1
5
  /* use this for style redefinitions to awoid problems with
2
6
  unpredictable css rules order in build */
3
- .logo {
7
+ .pc-logo {
4
8
  display: flex;
5
9
  align-items: center;
6
- font-weight: 500;
7
- font-size: var(--yc-text-header-2-font-size);
8
- line-height: var(--yc-text-header-2-line-height);
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);
9
15
  }
10
- .logo__icon {
11
- width: 178px;
12
- height: 36px;
16
+ .pc-logo__icon {
17
+ display: flex;
13
18
  margin-right: 8px;
14
19
  object-fit: contain;
15
20
  }
16
- .logo__text {
21
+ .pc-logo__text {
17
22
  white-space: nowrap;
18
23
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { NavigationLogo } from '../../../../models/navigation';
2
+ import { NavigationLogo } from '../../../../models';
3
3
  import './Logo.css';
4
4
  export interface LogoProps extends NavigationLogo {
5
5
  className?: string;
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
- import block from 'bem-cn-lite';
3
- import { Image } from '../../../index';
2
+ import { block } from '../../../../utils';
4
3
  import RouterLink from '../../../RouterLink/RouterLink';
4
+ import { getMediaImage } from '../../../Media/Image/utils';
5
+ import { Image } from '../../../index';
5
6
  import './Logo.css';
6
7
  const b = block('logo');
7
- const Logo = ({ icon, text, className }) => (React.createElement(RouterLink, { href: "/", passHref: true },
8
- React.createElement("div", { className: b(null, className) },
9
- icon && React.createElement(Image, { className: b('icon'), src: icon }),
10
- React.createElement("span", { className: b('text') }, text))));
8
+ const Logo = ({ icon, text, className }) => {
9
+ const imageData = getMediaImage(icon);
10
+ return (React.createElement(RouterLink, { href: "/", passHref: true },
11
+ React.createElement("div", { className: b(null, className) },
12
+ imageData && React.createElement(Image, Object.assign({ className: b('icon') }, imageData)),
13
+ React.createElement("span", { className: b('text') }, text))));
14
+ };
11
15
  export default Logo;
@@ -1,6 +1,6 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
- .mobile-navigation {
3
+ .pc-mobile-navigation {
4
4
  position: fixed;
5
5
  z-index: 100;
6
6
  top: var(--header-height);
@@ -9,22 +9,22 @@ unpredictable css rules order in build */
9
9
  border-bottom-right-radius: var(--pc-border-radius);
10
10
  border-bottom-left-radius: var(--pc-border-radius);
11
11
  background-color: var(--yc-color-base-background);
12
- box-shadow: 0px 3px 10px var(--yc-color-sfx-shadow);
12
+ box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
13
13
  font-size: var(--yc-text-body-2-font-size);
14
14
  line-height: var(--yc-text-body-2-line-height);
15
15
  }
16
16
  @media (min-width: 769px) {
17
- .mobile-navigation {
17
+ .pc-mobile-navigation {
18
18
  display: none;
19
19
  }
20
20
  }
21
- .mobile-navigation__wrapper {
22
- padding: 32px 20px;
21
+ .pc-mobile-navigation__wrapper {
22
+ padding: 32px 48px;
23
23
  }
24
- .mobile-navigation__button {
24
+ .pc-mobile-navigation__button {
25
25
  margin-top: 24px;
26
26
  }
27
- .mobile-navigation__links {
27
+ .pc-mobile-navigation__links {
28
28
  position: relative;
29
29
  display: flex;
30
30
  flex-direction: column;
@@ -33,13 +33,13 @@ unpredictable css rules order in build */
33
33
  padding: 0;
34
34
  list-style: none;
35
35
  }
36
- .mobile-navigation__links-item:not(:last-child) {
36
+ .pc-mobile-navigation__links-item:not(:last-child) {
37
37
  margin-bottom: 24px;
38
38
  }
39
- .mobile-navigation__dropdown-item:not(:last-child) {
39
+ .pc-mobile-navigation__dropdown-item:not(:last-child) {
40
40
  margin-bottom: 16px;
41
41
  }
42
- .mobile-navigation__popup {
42
+ .pc-mobile-navigation__popup {
43
43
  z-index: 101;
44
44
  display: flex;
45
45
  flex-direction: column;
@@ -52,7 +52,13 @@ unpredictable css rules order in build */
52
52
  box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
53
53
  }
54
54
  @media (min-width: 769px) {
55
- .mobile-navigation__popup {
55
+ .pc-mobile-navigation__popup {
56
56
  display: none;
57
57
  }
58
+ }
59
+ @media (max-width: 576px) {
60
+ .pc-mobile-navigation__wrapper {
61
+ padding-left: 24px;
62
+ padding-right: 24px;
63
+ }
58
64
  }
@@ -1,7 +1,7 @@
1
- import block from 'bem-cn-lite';
2
1
  import React, { useRef, useCallback } from 'react';
3
- import Foldable from '../../../Foldable/Foldable';
4
2
  import { Popup, Portal } from '@gravity-ui/uikit';
3
+ import { block } from '../../../../utils';
4
+ import Foldable from '../../../Foldable/Foldable';
5
5
  import { NavigationItemType, } from '../../../../models/navigation';
6
6
  import NavigationItem from '../NavigationItem/NavigationItem';
7
7
  import './MobileNavigation.css';
@@ -1,10 +1,10 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
- .navigation {
3
+ .pc-navigation {
4
4
  font-size: var(--yc-text-body-2-font-size);
5
5
  line-height: var(--yc-text-body-2-line-height);
6
6
  }
7
- .navigation__links {
7
+ .pc-navigation__links {
8
8
  position: relative;
9
9
  display: flex;
10
10
  align-items: center;
@@ -12,7 +12,7 @@ unpredictable css rules order in build */
12
12
  padding: 0;
13
13
  list-style: none;
14
14
  }
15
- .navigation__links-item {
15
+ .pc-navigation__links-item {
16
16
  position: relative;
17
17
  height: var(--header-height);
18
18
  line-height: var(--header-height);
@@ -21,22 +21,22 @@ unpredictable css rules order in build */
21
21
  color: inherit;
22
22
  text-decoration: none;
23
23
  }
24
- .utilityfocus .navigation__links-item:focus {
24
+ .utilityfocus .pc-navigation__links-item:focus {
25
25
  outline: 2px solid #ffdb4d;
26
26
  }
27
- .navigation__links-item:hover, .navigation__links-item:active {
27
+ .pc-navigation__links-item:hover, .pc-navigation__links-item:active {
28
28
  color: var(--yc-color-text-link);
29
29
  }
30
- .navigation__links-item:not(:last-child) {
30
+ .pc-navigation__links-item:not(:last-child) {
31
31
  margin-right: 20px;
32
32
  }
33
- .navigation__slider-container {
33
+ .pc-navigation__slider-container {
34
34
  position: absolute;
35
35
  right: 0;
36
36
  bottom: 0;
37
37
  left: 0;
38
38
  }
39
- .navigation__slider {
39
+ .pc-navigation__slider {
40
40
  width: 100%;
41
41
  height: 2px;
42
42
  background-color: var(--yc-color-text-link);
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { NavigationItem as NavigationItemModel } from '../../../../models/navigation';
1
+ import React, { MouseEventHandler } from 'react';
2
+ import { NavigationDropdownItem, NavigationItem as NavigationItemModel } from '../../../../models/navigation';
3
3
  import './Navigation.css';
4
4
  export interface NavigationProps {
5
5
  links: NavigationItemModel[];
@@ -8,5 +8,12 @@ export interface NavigationProps {
8
8
  className?: string;
9
9
  highlightActiveItem?: boolean;
10
10
  }
11
+ export interface NavigationDropdownProps {
12
+ data: NavigationDropdownItem;
13
+ onClick: MouseEventHandler;
14
+ isActive: boolean;
15
+ position: number;
16
+ hidePopup: () => void;
17
+ }
11
18
  declare const Navigation: React.FC<NavigationProps>;
12
19
  export default Navigation;