@gravity-ui/page-constructor 4.31.0 → 4.31.1
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/Logo/Logo.css +1 -0
- package/build/cjs/navigation/components/Logo/Logo.js +10 -5
- package/build/esm/models/navigation.d.ts +1 -0
- package/build/esm/navigation/components/Logo/Logo.css +1 -0
- package/build/esm/navigation/components/Logo/Logo.js +11 -6
- package/package.json +1 -1
- package/server/models/navigation.d.ts +1 -0
- package/widget/index.js +1 -1
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = tslib_1.
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const components_1 = require("../../../components");
|
|
6
6
|
const utils_1 = require("../../../components/Media/Image/utils");
|
|
7
7
|
const RouterLink_1 = tslib_1.__importDefault(require("../../../components/RouterLink/RouterLink"));
|
|
8
|
+
const locationContext_1 = require("../../../context/locationContext");
|
|
8
9
|
const theme_1 = require("../../../context/theme");
|
|
9
10
|
const utils_2 = require("../../../utils");
|
|
10
11
|
const b = (0, utils_2.block)('logo');
|
|
11
12
|
const Logo = (props) => {
|
|
13
|
+
const { hostname, Link } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
12
14
|
const theme = (0, theme_1.useTheme)();
|
|
13
15
|
const themedLogoProps = (0, utils_2.getThemedValue)(props, theme) || props;
|
|
14
16
|
const imageData = (0, utils_1.getMediaImage)(themedLogoProps.icon || props.icon);
|
|
15
17
|
const textData = themedLogoProps.text || props.text;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const url = themedLogoProps.url || props.url || '/';
|
|
19
|
+
const urlTitle = themedLogoProps.urlTitle || props.urlTitle || textData;
|
|
20
|
+
const linkExtraProps = (0, utils_2.getLinkProps)(url, hostname);
|
|
21
|
+
const content = (react_1.default.createElement(react_1.Fragment, null,
|
|
22
|
+
imageData && react_1.default.createElement(components_1.Image, Object.assign({ className: b('icon') }, imageData)),
|
|
23
|
+
react_1.default.createElement("span", { className: b('text') }, textData)));
|
|
24
|
+
return (react_1.default.createElement(RouterLink_1.default, { href: url, passHref: true }, Link ? (react_1.default.createElement("span", { className: b(null, props.className) }, content)) : (react_1.default.createElement("a", Object.assign({ className: b(null, props.className), href: url, title: urlTitle }, linkExtraProps), content))));
|
|
20
25
|
};
|
|
21
26
|
exports.default = Logo;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Fragment, useContext } from 'react';
|
|
2
2
|
import { Image } from '../../../components';
|
|
3
3
|
import { getMediaImage } from '../../../components/Media/Image/utils';
|
|
4
4
|
import RouterLink from '../../../components/RouterLink/RouterLink';
|
|
5
|
+
import { LocationContext } from '../../../context/locationContext';
|
|
5
6
|
import { useTheme } from '../../../context/theme';
|
|
6
|
-
import { block, getThemedValue } from '../../../utils';
|
|
7
|
+
import { block, getLinkProps, getThemedValue } from '../../../utils';
|
|
7
8
|
import './Logo.css';
|
|
8
9
|
const b = block('logo');
|
|
9
10
|
const Logo = (props) => {
|
|
11
|
+
const { hostname, Link } = useContext(LocationContext);
|
|
10
12
|
const theme = useTheme();
|
|
11
13
|
const themedLogoProps = getThemedValue(props, theme) || props;
|
|
12
14
|
const imageData = getMediaImage(themedLogoProps.icon || props.icon);
|
|
13
15
|
const textData = themedLogoProps.text || props.text;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const url = themedLogoProps.url || props.url || '/';
|
|
17
|
+
const urlTitle = themedLogoProps.urlTitle || props.urlTitle || textData;
|
|
18
|
+
const linkExtraProps = getLinkProps(url, hostname);
|
|
19
|
+
const content = (React.createElement(Fragment, null,
|
|
20
|
+
imageData && React.createElement(Image, Object.assign({ className: b('icon') }, imageData)),
|
|
21
|
+
React.createElement("span", { className: b('text') }, textData)));
|
|
22
|
+
return (React.createElement(RouterLink, { href: url, passHref: true }, Link ? (React.createElement("span", { className: b(null, props.className) }, content)) : (React.createElement("a", Object.assign({ className: b(null, props.className), href: url, title: urlTitle }, linkExtraProps), content))));
|
|
18
23
|
};
|
|
19
24
|
export default Logo;
|
package/package.json
CHANGED