@gravity-ui/page-constructor 5.4.0 → 5.6.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/models/navigation.d.ts +1 -0
- package/build/cjs/navigation/components/Navigation/Navigation.js +3 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +6 -3
- package/build/esm/models/navigation.d.ts +1 -0
- package/build/esm/navigation/components/Navigation/Navigation.js +3 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +7 -4
- package/package.json +1 -1
- package/server/models/navigation.d.ts +1 -0
- package/widget/index.js +1 -1
|
@@ -12,7 +12,7 @@ const DesktopNavigation_1 = tslib_1.__importDefault(require("../DesktopNavigatio
|
|
|
12
12
|
const MobileNavigation_1 = tslib_1.__importDefault(require("../MobileNavigation/MobileNavigation"));
|
|
13
13
|
const b = (0, utils_1.block)('navigation');
|
|
14
14
|
const Navigation = ({ data, logo, className }) => {
|
|
15
|
-
const { leftItems, rightItems, iconSize = 20, withBorder = false } = data;
|
|
15
|
+
const { leftItems, rightItems, iconSize = 20, withBorder = false, withBorderOnScroll = true, } = data;
|
|
16
16
|
const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
|
|
17
17
|
const [activeItemId, setActiveItemId] = (0, react_1.useState)(undefined);
|
|
18
18
|
const [showBorder, setShowBorder] = (0, react_1.useState)(withBorder);
|
|
@@ -24,6 +24,8 @@ const Navigation = ({ data, logo, className }) => {
|
|
|
24
24
|
};
|
|
25
25
|
const onSidebarOpenedChange = (isOpen) => setIsSidebarOpened(isOpen);
|
|
26
26
|
(0, react_1.useEffect)(() => {
|
|
27
|
+
if (!withBorderOnScroll)
|
|
28
|
+
return () => { };
|
|
27
29
|
const showBorderOnScroll = () => {
|
|
28
30
|
if (!showBorder) {
|
|
29
31
|
setShowBorder(window.scrollY > 0);
|
|
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const components_1 = require("../../components");
|
|
7
|
+
const theme_1 = require("../../context/theme");
|
|
7
8
|
const utils_1 = require("../../utils");
|
|
8
9
|
const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
|
|
9
10
|
const utils_2 = require("./utils");
|
|
@@ -12,16 +13,18 @@ const LayoutItem = (_a) => {
|
|
|
12
13
|
var _b = _a.content, { links, buttons } = _b, content = tslib_1.__rest(_b, ["links", "buttons"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
|
|
13
14
|
const normalizedLinks = (0, react_1.useMemo)(() => (0, utils_2.getLayoutItemLinks)(links), [links]);
|
|
14
15
|
const areControlsInFooter = controlPosition === 'footer';
|
|
16
|
+
const theme = (0, theme_1.useTheme)();
|
|
15
17
|
const contentProps = Object.assign(Object.assign(Object.assign({}, content), (areControlsInFooter ? {} : { links: normalizedLinks, buttons })), { size: 's', colSizes: { all: 12, md: 12 } });
|
|
16
18
|
const titleId = (0, uikit_1.useUniqId)();
|
|
17
19
|
const renderMedia = () => {
|
|
18
20
|
if (!media) {
|
|
19
21
|
return null;
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
const themedMedia = (0, utils_1.getThemedValue)(media, theme);
|
|
24
|
+
return fullscreen && (0, utils_2.hasFullscreen)(themedMedia) ? (react_1.default.createElement(components_1.FullscreenMedia, { showFullscreenIcon: (0, utils_2.showFullscreenIcon)(themedMedia) }, (_a = {}) => {
|
|
22
25
|
var { className: mediaClassName, fullscreen: _fullscreen } = _a, fullscreenMediaProps = tslib_1.__rest(_a, ["className", "fullscreen"]);
|
|
23
|
-
return (react_1.default.createElement(components_1.Media, Object.assign({},
|
|
24
|
-
})) : (react_1.default.createElement(components_1.Media, Object.assign({},
|
|
26
|
+
return (react_1.default.createElement(components_1.Media, Object.assign({}, themedMedia, fullscreenMediaProps, { className: b('media', { border }, mediaClassName), analyticsEvents: analyticsEvents })));
|
|
27
|
+
})) : (react_1.default.createElement(components_1.Media, Object.assign({}, themedMedia, { className: b('media', { border }), analyticsEvents: analyticsEvents })));
|
|
25
28
|
};
|
|
26
29
|
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
27
30
|
renderMedia(),
|
|
@@ -9,7 +9,7 @@ import MobileNavigation from '../MobileNavigation/MobileNavigation';
|
|
|
9
9
|
import './Navigation.css';
|
|
10
10
|
const b = block('navigation');
|
|
11
11
|
export const Navigation = ({ data, logo, className }) => {
|
|
12
|
-
const { leftItems, rightItems, iconSize = 20, withBorder = false } = data;
|
|
12
|
+
const { leftItems, rightItems, iconSize = 20, withBorder = false, withBorderOnScroll = true, } = data;
|
|
13
13
|
const [isSidebarOpened, setIsSidebarOpened] = useState(false);
|
|
14
14
|
const [activeItemId, setActiveItemId] = useState(undefined);
|
|
15
15
|
const [showBorder, setShowBorder] = useState(withBorder);
|
|
@@ -21,6 +21,8 @@ export const Navigation = ({ data, logo, className }) => {
|
|
|
21
21
|
};
|
|
22
22
|
const onSidebarOpenedChange = (isOpen) => setIsSidebarOpened(isOpen);
|
|
23
23
|
useEffect(() => {
|
|
24
|
+
if (!withBorderOnScroll)
|
|
25
|
+
return () => { };
|
|
24
26
|
const showBorderOnScroll = () => {
|
|
25
27
|
if (!showBorder) {
|
|
26
28
|
setShowBorder(window.scrollY > 0);
|
|
@@ -2,7 +2,8 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
4
4
|
import { Buttons, FullscreenMedia, IconWrapper, Links, Media, MetaInfo } from '../../components';
|
|
5
|
-
import {
|
|
5
|
+
import { useTheme } from '../../context/theme';
|
|
6
|
+
import { block, getThemedValue } from '../../utils';
|
|
6
7
|
import Content from '../Content/Content';
|
|
7
8
|
import { getLayoutItemLinks, hasFullscreen, showFullscreenIcon } from './utils';
|
|
8
9
|
import './LayoutItem.css';
|
|
@@ -11,16 +12,18 @@ const LayoutItem = (_a) => {
|
|
|
11
12
|
var _b = _a.content, { links, buttons } = _b, content = __rest(_b, ["links", "buttons"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
|
|
12
13
|
const normalizedLinks = useMemo(() => getLayoutItemLinks(links), [links]);
|
|
13
14
|
const areControlsInFooter = controlPosition === 'footer';
|
|
15
|
+
const theme = useTheme();
|
|
14
16
|
const contentProps = Object.assign(Object.assign(Object.assign({}, content), (areControlsInFooter ? {} : { links: normalizedLinks, buttons })), { size: 's', colSizes: { all: 12, md: 12 } });
|
|
15
17
|
const titleId = useUniqId();
|
|
16
18
|
const renderMedia = () => {
|
|
17
19
|
if (!media) {
|
|
18
20
|
return null;
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
const themedMedia = getThemedValue(media, theme);
|
|
23
|
+
return fullscreen && hasFullscreen(themedMedia) ? (React.createElement(FullscreenMedia, { showFullscreenIcon: showFullscreenIcon(themedMedia) }, (_a = {}) => {
|
|
21
24
|
var { className: mediaClassName, fullscreen: _fullscreen } = _a, fullscreenMediaProps = __rest(_a, ["className", "fullscreen"]);
|
|
22
|
-
return (React.createElement(Media, Object.assign({},
|
|
23
|
-
})) : (React.createElement(Media, Object.assign({},
|
|
25
|
+
return (React.createElement(Media, Object.assign({}, themedMedia, fullscreenMediaProps, { className: b('media', { border }, mediaClassName), analyticsEvents: analyticsEvents })));
|
|
26
|
+
})) : (React.createElement(Media, Object.assign({}, themedMedia, { className: b('media', { border }), analyticsEvents: analyticsEvents })));
|
|
24
27
|
};
|
|
25
28
|
return (React.createElement("div", { className: b(null, className) },
|
|
26
29
|
renderMedia(),
|
package/package.json
CHANGED