@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.
@@ -62,6 +62,7 @@ export interface NavigationLogoData {
62
62
  icon: ImageProps;
63
63
  text?: string;
64
64
  url?: string;
65
+ urlTitle?: string;
65
66
  }
66
67
  export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;
67
68
  export interface HeaderData {
@@ -7,6 +7,7 @@ unpredictable css rules order in build */
7
7
  .pc-logo {
8
8
  display: flex;
9
9
  align-items: center;
10
+ text-decoration: none;
10
11
  }
11
12
  .pc-logo__icon {
12
13
  display: flex;
@@ -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.__importDefault(require("react"));
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
- return (react_1.default.createElement(RouterLink_1.default, { href: themedLogoProps.url || props.url || '/', passHref: true },
17
- react_1.default.createElement("div", { className: b(null, props.className) },
18
- imageData && react_1.default.createElement(components_1.Image, Object.assign({ className: b('icon') }, imageData)),
19
- react_1.default.createElement("span", { className: b('text') }, textData))));
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;
@@ -62,6 +62,7 @@ export interface NavigationLogoData {
62
62
  icon: ImageProps;
63
63
  text?: string;
64
64
  url?: string;
65
+ urlTitle?: string;
65
66
  }
66
67
  export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;
67
68
  export interface HeaderData {
@@ -7,6 +7,7 @@ unpredictable css rules order in build */
7
7
  .pc-logo {
8
8
  display: flex;
9
9
  align-items: center;
10
+ text-decoration: none;
10
11
  }
11
12
  .pc-logo__icon {
12
13
  display: flex;
@@ -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
- return (React.createElement(RouterLink, { href: themedLogoProps.url || props.url || '/', passHref: true },
15
- React.createElement("div", { className: b(null, props.className) },
16
- imageData && React.createElement(Image, Object.assign({ className: b('icon') }, imageData)),
17
- React.createElement("span", { className: b('text') }, textData))));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.31.0",
3
+ "version": "4.31.1",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -62,6 +62,7 @@ export interface NavigationLogoData {
62
62
  icon: ImageProps;
63
63
  text?: string;
64
64
  url?: string;
65
+ urlTitle?: string;
65
66
  }
66
67
  export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;
67
68
  export interface HeaderData {