@gravity-ui/page-constructor 1.7.0-alpha.1 → 1.7.0-alpha.2
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/components/navigation/components/Logo/Logo.css +10 -4
- package/build/cjs/components/navigation/components/Logo/Logo.d.ts +1 -1
- package/build/cjs/components/navigation/components/Logo/Logo.js +9 -5
- package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +6 -3
- package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +6 -2
- package/build/cjs/models/index.d.ts +1 -0
- package/build/cjs/models/index.js +1 -0
- package/build/cjs/models/navigation.d.ts +4 -4
- package/build/esm/components/navigation/components/Logo/Logo.css +10 -4
- package/build/esm/components/navigation/components/Logo/Logo.d.ts +1 -1
- package/build/esm/components/navigation/components/Logo/Logo.js +9 -5
- package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +6 -3
- package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +6 -2
- package/build/esm/models/index.d.ts +1 -0
- package/build/esm/models/index.js +1 -0
- package/build/esm/models/navigation.d.ts +4 -4
- package/package.json +1 -1
- package/server/models/index.d.ts +1 -0
- package/server/models/index.js +1 -0
- package/server/models/navigation.d.ts +59 -0
- package/server/models/navigation.js +10 -0
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
.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
7
|
.logo {
|
|
4
8
|
display: flex;
|
|
5
9
|
align-items: center;
|
|
6
|
-
font-weight:
|
|
7
|
-
font-size: var(--yc-text-header-
|
|
8
|
-
line-height: var(--yc-text-header-
|
|
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
16
|
.logo__icon {
|
|
11
|
-
|
|
17
|
+
display: flex;
|
|
12
18
|
height: 36px;
|
|
13
19
|
margin-right: 8px;
|
|
14
20
|
object-fit: contain;
|
|
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
5
5
|
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
6
|
-
const index_1 = require("../../../index");
|
|
7
6
|
const RouterLink_1 = (0, tslib_1.__importDefault)(require("../../../RouterLink/RouterLink"));
|
|
7
|
+
const utils_1 = require("../../../Media/Image/utils");
|
|
8
|
+
const index_1 = require("../../../index");
|
|
8
9
|
const b = (0, bem_cn_lite_1.default)('logo');
|
|
9
|
-
const Logo = ({ icon, text, className }) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
react_1.default.createElement("
|
|
10
|
+
const Logo = ({ icon, text, className }) => {
|
|
11
|
+
const imageData = (0, utils_1.getMediaImage)(icon);
|
|
12
|
+
return (react_1.default.createElement(RouterLink_1.default, { href: "/", passHref: true },
|
|
13
|
+
react_1.default.createElement("div", { className: b(null, className) },
|
|
14
|
+
imageData && react_1.default.createElement(index_1.Image, Object.assign({}, imageData)),
|
|
15
|
+
react_1.default.createElement("span", { className: b('text') }, text))));
|
|
16
|
+
};
|
|
13
17
|
exports.default = Logo;
|
|
@@ -9,22 +9,25 @@ const locationContext_1 = require("../../../../context/locationContext");
|
|
|
9
9
|
const navigation_1 = require("../../../../models/navigation");
|
|
10
10
|
const icons_1 = require("../../../../icons");
|
|
11
11
|
const SocialIcon_1 = (0, tslib_1.__importDefault)(require("../SocialIcon/SocialIcon"));
|
|
12
|
+
const utils_2 = require("../../../Media/Image/utils");
|
|
12
13
|
const b = (0, bem_cn_lite_1.default)('navigation-item');
|
|
13
14
|
const Content = ({ text, icon }) => (react_1.default.createElement(react_1.Fragment, null,
|
|
14
|
-
icon && react_1.default.createElement("img", { className: b('icon'),
|
|
15
|
+
icon && react_1.default.createElement("img", Object.assign({ className: b('icon') }, icon)),
|
|
15
16
|
react_1.default.createElement("span", { className: b('text') }, text)));
|
|
16
17
|
const NavigationDropdown = (_a) => {
|
|
17
18
|
var { text, icon, isOpened } = _a, props = (0, tslib_1.__rest)(_a, ["text", "icon", "isOpened"]);
|
|
19
|
+
const iconData = icon && (0, utils_2.getMediaImage)(icon);
|
|
18
20
|
return (react_1.default.createElement("span", Object.assign({}, props),
|
|
19
|
-
react_1.default.createElement(Content, { text: text, icon:
|
|
21
|
+
react_1.default.createElement(Content, { text: text, icon: iconData }),
|
|
20
22
|
react_1.default.createElement(index_1.ToggleArrow, { className: b('dropdown'), size: 12, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
21
23
|
};
|
|
22
24
|
const NavigationLink = (props) => {
|
|
23
25
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
24
26
|
const { url, text, icon, arrow, target } = props, rest = (0, tslib_1.__rest)(props, ["url", "text", "icon", "arrow", "target"]);
|
|
25
27
|
const linkExtraProps = (0, utils_1.getLinkProps)(url, hostname, target);
|
|
28
|
+
const iconData = icon && (0, utils_2.getMediaImage)(icon);
|
|
26
29
|
const content = (react_1.default.createElement(react_1.Fragment, null,
|
|
27
|
-
react_1.default.createElement(Content, { text: text, icon:
|
|
30
|
+
react_1.default.createElement(Content, { text: text, icon: iconData }),
|
|
28
31
|
arrow && react_1.default.createElement(icons_1.NavigationArrow, { className: b('arrow') })));
|
|
29
32
|
return (linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) ? (react_1.default.createElement("a", Object.assign({ href: url, title: text }, rest, linkExtraProps), content)) : (react_1.default.createElement(index_1.RouterLink, { href: url, passHref: true },
|
|
30
33
|
react_1.default.createElement("a", Object.assign({}, rest), content)));
|
|
@@ -4,7 +4,11 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
5
5
|
const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
|
|
6
6
|
const index_1 = require("../../../index");
|
|
7
|
+
const utils_1 = require("../../../Media/Image/utils");
|
|
7
8
|
const b = (0, bem_cn_lite_1.default)('social-icon');
|
|
8
|
-
const SocialIcon = ({ icon, url, className }) =>
|
|
9
|
-
|
|
9
|
+
const SocialIcon = ({ icon, url, className }) => {
|
|
10
|
+
const iconData = (0, utils_1.getMediaImage)(icon);
|
|
11
|
+
return (react_1.default.createElement("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
|
|
12
|
+
react_1.default.createElement(index_1.Image, Object.assign({ className: b('icon') }, iconData))));
|
|
13
|
+
};
|
|
10
14
|
exports.default = SocialIcon;
|
|
@@ -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 '
|
|
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?:
|
|
10
|
+
icon?: ImageProps;
|
|
11
11
|
url?: string;
|
|
12
12
|
}
|
|
13
13
|
export interface NavigationLinkItem extends NavigationItemBase {
|
|
@@ -27,12 +27,12 @@ export interface NavigationDropdownItem extends NavigationItemBase {
|
|
|
27
27
|
}
|
|
28
28
|
export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
|
|
29
29
|
type: NavigationItemType.Social;
|
|
30
|
-
icon:
|
|
30
|
+
icon: ImageProps;
|
|
31
31
|
url: string;
|
|
32
32
|
}
|
|
33
33
|
export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
|
|
34
34
|
export interface NavigationLogo extends Omit<NavigationItemBase, 'text'> {
|
|
35
|
-
icon:
|
|
35
|
+
icon: ImageProps;
|
|
36
36
|
text?: string;
|
|
37
37
|
}
|
|
38
38
|
export interface HeaderData {
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
.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
7
|
.logo {
|
|
4
8
|
display: flex;
|
|
5
9
|
align-items: center;
|
|
6
|
-
font-weight:
|
|
7
|
-
font-size: var(--yc-text-header-
|
|
8
|
-
line-height: var(--yc-text-header-
|
|
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
16
|
.logo__icon {
|
|
11
|
-
|
|
17
|
+
display: flex;
|
|
12
18
|
height: 36px;
|
|
13
19
|
margin-right: 8px;
|
|
14
20
|
object-fit: contain;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import block from 'bem-cn-lite';
|
|
3
|
-
import { Image } from '../../../index';
|
|
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 }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
React.createElement("
|
|
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({}, imageData)),
|
|
13
|
+
React.createElement("span", { className: b('text') }, text))));
|
|
14
|
+
};
|
|
11
15
|
export default Logo;
|
|
@@ -7,23 +7,26 @@ import { LocationContext } from '../../../../context/locationContext';
|
|
|
7
7
|
import { NavigationItemType, } from '../../../../models/navigation';
|
|
8
8
|
import { NavigationArrow } from '../../../../icons';
|
|
9
9
|
import SocialIcon from '../SocialIcon/SocialIcon';
|
|
10
|
+
import { getMediaImage } from '../../../Media/Image/utils';
|
|
10
11
|
import './NavigationItem.css';
|
|
11
12
|
const b = block('navigation-item');
|
|
12
13
|
const Content = ({ text, icon }) => (React.createElement(Fragment, null,
|
|
13
|
-
icon && React.createElement("img", { className: b('icon'),
|
|
14
|
+
icon && React.createElement("img", Object.assign({ className: b('icon') }, icon)),
|
|
14
15
|
React.createElement("span", { className: b('text') }, text)));
|
|
15
16
|
const NavigationDropdown = (_a) => {
|
|
16
17
|
var { text, icon, isOpened } = _a, props = __rest(_a, ["text", "icon", "isOpened"]);
|
|
18
|
+
const iconData = icon && getMediaImage(icon);
|
|
17
19
|
return (React.createElement("span", Object.assign({}, props),
|
|
18
|
-
React.createElement(Content, { text: text, icon:
|
|
20
|
+
React.createElement(Content, { text: text, icon: iconData }),
|
|
19
21
|
React.createElement(ToggleArrow, { className: b('dropdown'), size: 12, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
20
22
|
};
|
|
21
23
|
const NavigationLink = (props) => {
|
|
22
24
|
const { hostname } = useContext(LocationContext);
|
|
23
25
|
const { url, text, icon, arrow, target } = props, rest = __rest(props, ["url", "text", "icon", "arrow", "target"]);
|
|
24
26
|
const linkExtraProps = getLinkProps(url, hostname, target);
|
|
27
|
+
const iconData = icon && getMediaImage(icon);
|
|
25
28
|
const content = (React.createElement(Fragment, null,
|
|
26
|
-
React.createElement(Content, { text: text, icon:
|
|
29
|
+
React.createElement(Content, { text: text, icon: iconData }),
|
|
27
30
|
arrow && React.createElement(NavigationArrow, { className: b('arrow') })));
|
|
28
31
|
return (linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) ? (React.createElement("a", Object.assign({ href: url, title: text }, rest, linkExtraProps), content)) : (React.createElement(RouterLink, { href: url, passHref: true },
|
|
29
32
|
React.createElement("a", Object.assign({}, rest), content)));
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import block from 'bem-cn-lite';
|
|
3
3
|
import { Image } from '../../../index';
|
|
4
|
+
import { getMediaImage } from '../../../Media/Image/utils';
|
|
4
5
|
import './SocialIcon.css';
|
|
5
6
|
const b = block('social-icon');
|
|
6
|
-
const SocialIcon = ({ icon, url, className }) =>
|
|
7
|
-
|
|
7
|
+
const SocialIcon = ({ icon, url, className }) => {
|
|
8
|
+
const iconData = getMediaImage(icon);
|
|
9
|
+
return (React.createElement("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
|
|
10
|
+
React.createElement(Image, Object.assign({ className: b('icon') }, iconData))));
|
|
11
|
+
};
|
|
8
12
|
export default SocialIcon;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps } from '
|
|
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?:
|
|
10
|
+
icon?: ImageProps;
|
|
11
11
|
url?: string;
|
|
12
12
|
}
|
|
13
13
|
export interface NavigationLinkItem extends NavigationItemBase {
|
|
@@ -27,12 +27,12 @@ export interface NavigationDropdownItem extends NavigationItemBase {
|
|
|
27
27
|
}
|
|
28
28
|
export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
|
|
29
29
|
type: NavigationItemType.Social;
|
|
30
|
-
icon:
|
|
30
|
+
icon: ImageProps;
|
|
31
31
|
url: string;
|
|
32
32
|
}
|
|
33
33
|
export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
|
|
34
34
|
export interface NavigationLogo extends Omit<NavigationItemBase, 'text'> {
|
|
35
|
-
icon:
|
|
35
|
+
icon: ImageProps;
|
|
36
36
|
text?: string;
|
|
37
37
|
}
|
|
38
38
|
export interface HeaderData {
|
package/package.json
CHANGED
package/server/models/index.d.ts
CHANGED
package/server/models/index.js
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ImageProps, ButtonProps } from './constructor-items';
|
|
2
|
+
export declare enum NavigationItemType {
|
|
3
|
+
Link = "link",
|
|
4
|
+
Dropdown = "dropdown",
|
|
5
|
+
Button = "button",
|
|
6
|
+
Social = "social"
|
|
7
|
+
}
|
|
8
|
+
export interface NavigationItemBase {
|
|
9
|
+
text: string;
|
|
10
|
+
icon?: ImageProps;
|
|
11
|
+
url?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface NavigationLinkItem extends NavigationItemBase {
|
|
14
|
+
type: NavigationItemType.Link;
|
|
15
|
+
url: string;
|
|
16
|
+
arrow?: boolean;
|
|
17
|
+
target?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface NavigationButtonItem extends ButtonProps {
|
|
20
|
+
type: NavigationItemType.Button;
|
|
21
|
+
url: string;
|
|
22
|
+
target?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface NavigationDropdownItem extends NavigationItemBase {
|
|
25
|
+
type: NavigationItemType.Dropdown;
|
|
26
|
+
items: NavigationLinkItem[];
|
|
27
|
+
}
|
|
28
|
+
export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
|
|
29
|
+
type: NavigationItemType.Social;
|
|
30
|
+
icon: ImageProps;
|
|
31
|
+
url: string;
|
|
32
|
+
}
|
|
33
|
+
export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
|
|
34
|
+
export interface NavigationLogo extends Omit<NavigationItemBase, 'text'> {
|
|
35
|
+
icon: ImageProps;
|
|
36
|
+
text?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface HeaderData {
|
|
39
|
+
leftItems: NavigationItem[];
|
|
40
|
+
rightItems?: NavigationItem[];
|
|
41
|
+
}
|
|
42
|
+
export interface FooterColumn {
|
|
43
|
+
title: string;
|
|
44
|
+
links: NavigationItem[];
|
|
45
|
+
}
|
|
46
|
+
export interface FooterUnderline {
|
|
47
|
+
links?: NavigationItem[];
|
|
48
|
+
copyright?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface FooterData {
|
|
51
|
+
columns: FooterColumn[];
|
|
52
|
+
social?: NavigationSocialItem[];
|
|
53
|
+
underline?: FooterUnderline;
|
|
54
|
+
}
|
|
55
|
+
export interface NavigationData {
|
|
56
|
+
logo: NavigationLogo;
|
|
57
|
+
header: HeaderData;
|
|
58
|
+
footer?: FooterData;
|
|
59
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationItemType = void 0;
|
|
4
|
+
var NavigationItemType;
|
|
5
|
+
(function (NavigationItemType) {
|
|
6
|
+
NavigationItemType["Link"] = "link";
|
|
7
|
+
NavigationItemType["Dropdown"] = "dropdown";
|
|
8
|
+
NavigationItemType["Button"] = "button";
|
|
9
|
+
NavigationItemType["Social"] = "social";
|
|
10
|
+
})(NavigationItemType = exports.NavigationItemType || (exports.NavigationItemType = {}));
|