@doyourjob/gravity-ui-page-constructor-addons 2.1.32 → 2.1.33

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.
@@ -145,8 +145,8 @@ unpredictable css rules order in build */
145
145
  line-height: var(--g-text-body-2-line-height, var(--pc-text-body-2-line-height));
146
146
  color: var(--g-color-text-primary);
147
147
  font-weight: 600;
148
- margin-bottom: auto;
149
148
  z-index: 1;
149
+ margin-bottom: 4px;
150
150
  }
151
151
 
152
152
  .pc-addons-nh-default-popup__stock-value {
@@ -154,8 +154,8 @@ unpredictable css rules order in build */
154
154
  font-size: 36px;
155
155
  line-height: 48px;
156
156
  font-weight: 600;
157
- margin-bottom: 4px;
158
157
  z-index: 1;
158
+ margin-top: auto;
159
159
  }
160
160
 
161
161
  .pc-addons-nh-default-popup__stock-date {
@@ -163,4 +163,5 @@ unpredictable css rules order in build */
163
163
  line-height: var(--g-text-body-1-line-height, var(--pc-text-body-1-line-height));
164
164
  color: var(--g-color-text-secondary);
165
165
  z-index: 1;
166
+ margin-top: 4px;
166
167
  }
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { NHDefaultPopupData } from '../../models';
3
- export declare const NHDefaultPopup: ({ sections, right, maxWidth }: NHDefaultPopupData) => React.JSX.Element;
3
+ export declare const NHDefaultPopup: ({ sections, right, maxWidth, primaryColor, primaryColorHover, }: NHDefaultPopupData) => React.JSX.Element;
@@ -18,7 +18,19 @@ const NHEventCard = ({ title, caption, description, image, url }) => (react_1.de
18
18
  react_1.default.createElement("div", { className: b('card-caption') }, caption),
19
19
  react_1.default.createElement("div", { className: b('card-title') }, title),
20
20
  react_1.default.createElement("div", { className: b('card-description') }, description))));
21
- const NHDefaultPopup = ({ sections, right, maxWidth }) => {
21
+ const NHStock = ({ background }) => {
22
+ const data = (0, react_1.useContext)(gravity_ui_page_constructor_1.HeaderStockContext);
23
+ if (!data.price)
24
+ return null;
25
+ return (react_1.default.createElement("div", { className: b('stock') },
26
+ background ? (react_1.default.createElement("img", { className: b('stock-background'), src: background, alt: "Stock background" })) : null,
27
+ react_1.default.createElement("div", { className: b('stock-title') }, data.price.name),
28
+ react_1.default.createElement("div", { className: b('stock-title') }, data.price.percent),
29
+ react_1.default.createElement("div", { className: b('stock-value') }, data.price.price),
30
+ react_1.default.createElement("div", { className: b('stock-date') }, data.price.update),
31
+ react_1.default.createElement("div", { className: b('stock-date') }, data.price.delayed)));
32
+ };
33
+ const NHDefaultPopup = ({ sections, right, maxWidth, primaryColor, primaryColorHover, }) => {
22
34
  const rootStyle = (0, react_1.useMemo)(() => maxWidth
23
35
  ? {
24
36
  marginLeft: 'auto',
@@ -42,14 +54,10 @@ const NHDefaultPopup = ({ sections, right, maxWidth }) => {
42
54
  section.title || section.subtitle ? (react_1.default.createElement("div", { className: b('head') },
43
55
  react_1.default.createElement("div", { className: b('title') }, section.title),
44
56
  react_1.default.createElement("div", { className: b('subtitle') }, section.subtitle))) : null,
45
- react_1.default.createElement("div", { className: b('wrap'), style: wrapsStyle[index] }, section.items.map((item) => (react_1.default.createElement(NHPopupItem_1.NHPopupItem, Object.assign({ key: item.title }, item))))))))),
57
+ react_1.default.createElement("div", { className: b('wrap'), style: wrapsStyle[index] }, section.items.map((item) => (react_1.default.createElement(NHPopupItem_1.NHPopupItem, Object.assign({ key: item.title }, item, { imageColor: primaryColor, imageColorHover: primaryColorHover }))))))))),
46
58
  right && (react_1.default.createElement("div", { className: b('right') },
47
59
  react_1.default.createElement("div", { className: b('title') }, right.title),
48
60
  cards && react_1.default.createElement("div", { className: b('cards') }, cards),
49
- right.stock && (react_1.default.createElement("div", { className: b('stock') },
50
- right.stock.background ? (react_1.default.createElement("img", { className: b('stock-background'), src: right.stock.background, alt: "Stock background" })) : null,
51
- react_1.default.createElement("div", { className: b('stock-title') }, right.stock.title),
52
- react_1.default.createElement("div", { className: b('stock-value') }, right.stock.value),
53
- react_1.default.createElement("div", { className: b('stock-date') }, right.stock.date)))))));
61
+ right.stock && react_1.default.createElement(NHStock, { background: right.stockImage })))));
54
62
  };
55
63
  exports.NHDefaultPopup = NHDefaultPopup;
@@ -88,6 +88,16 @@ unpredictable css rules order in build */
88
88
  height: 24px;
89
89
  }
90
90
 
91
+ @media (max-width: 769px) {
92
+ .pc-addons-nh-navigation-popup-item__image_desktop {
93
+ display: none;
94
+ }
95
+ }
96
+ @media (min-width: 770px) {
97
+ .pc-addons-nh-navigation-popup-item__image_mobile {
98
+ display: none;
99
+ }
100
+ }
91
101
  .pc-addons-nh-navigation-popup-item__image-container {
92
102
  padding: 8px;
93
103
  border-radius: 8px;
@@ -9,11 +9,13 @@ const cn_1 = require("../../../../utils/cn");
9
9
  const ArrowRight_1 = require("./ArrowRight");
10
10
  const b = (0, cn_1.block)('nh-navigation-popup-item');
11
11
  const NHPopupItem = (props) => {
12
- const { url, target, title, description, image, imageColor, imageColorHover, column } = props;
12
+ const { url, target, title, description, image, imageMobile, imageColor, imageColorHover, column, } = props;
13
13
  const styleImageContainer = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, (imageColor ? { '--nh-popup-item-color': imageColor } : {})), (imageColorHover ? { '--nh-popup-item-color-hover': imageColorHover } : {}))), [imageColor, imageColorHover]);
14
+ const hasImage = image || imageMobile;
14
15
  return (react_1.default.createElement("a", Object.assign({ className: b({ disable: !url, column }), href: url }, (0, gravity_ui_page_constructor_1.getLinkProps)(url || '', undefined, target)),
15
- image && (react_1.default.createElement("div", { className: b('image-container', { 'no-bg': !imageColor }), style: styleImageContainer },
16
- react_1.default.createElement(gravity_ui_page_constructor_1.Image, { className: b('image'), src: image }))),
16
+ hasImage && (react_1.default.createElement("div", { className: b('image-container', { 'no-bg': !imageColor }), style: styleImageContainer },
17
+ image && (react_1.default.createElement(gravity_ui_page_constructor_1.Image, { className: b('image', { desktop: Boolean(imageMobile) }), src: image })),
18
+ imageMobile && (react_1.default.createElement(gravity_ui_page_constructor_1.Image, { className: b('image', { mobile: true }), src: imageMobile })))),
17
19
  react_1.default.createElement("div", { className: b('container') },
18
20
  react_1.default.createElement("div", { className: b('title') },
19
21
  title,
@@ -15,6 +15,7 @@ export interface NHPopupItemData {
15
15
  slug?: string;
16
16
  description?: string;
17
17
  image?: string | null;
18
+ imageMobile?: string | null;
18
19
  imageColor?: string;
19
20
  imageColorHover?: string;
20
21
  target?: string;
@@ -65,20 +66,17 @@ export interface NHEventCardData {
65
66
  image: string;
66
67
  url: string;
67
68
  }
68
- export interface NHStockData {
69
- title: string;
70
- value: string;
71
- date: string;
72
- background?: string;
73
- }
74
69
  export interface NHDefaultPopupData {
75
70
  sections: NHDefaultPopupSection[];
76
71
  maxWidth?: number;
72
+ primaryColor?: string;
73
+ primaryColorHover?: string;
77
74
  right?: {
78
75
  title: string;
79
76
  stories?: NHStoryCardData[];
80
77
  events?: NHEventCardData[];
81
- stock?: NHStockData;
78
+ stock?: boolean;
79
+ stockImage?: string;
82
80
  };
83
81
  }
84
82
  export interface NHLoginItemData {
@@ -145,8 +145,8 @@ unpredictable css rules order in build */
145
145
  line-height: var(--g-text-body-2-line-height, var(--pc-text-body-2-line-height));
146
146
  color: var(--g-color-text-primary);
147
147
  font-weight: 600;
148
- margin-bottom: auto;
149
148
  z-index: 1;
149
+ margin-bottom: 4px;
150
150
  }
151
151
 
152
152
  .pc-addons-nh-default-popup__stock-value {
@@ -154,8 +154,8 @@ unpredictable css rules order in build */
154
154
  font-size: 36px;
155
155
  line-height: 48px;
156
156
  font-weight: 600;
157
- margin-bottom: 4px;
158
157
  z-index: 1;
158
+ margin-top: auto;
159
159
  }
160
160
 
161
161
  .pc-addons-nh-default-popup__stock-date {
@@ -163,4 +163,5 @@ unpredictable css rules order in build */
163
163
  line-height: var(--g-text-body-1-line-height, var(--pc-text-body-1-line-height));
164
164
  color: var(--g-color-text-secondary);
165
165
  z-index: 1;
166
+ margin-top: 4px;
166
167
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { NHDefaultPopupData } from '../../models';
3
3
  import './NHDefaultPopup.css';
4
- export declare const NHDefaultPopup: ({ sections, right, maxWidth }: NHDefaultPopupData) => React.JSX.Element;
4
+ export declare const NHDefaultPopup: ({ sections, right, maxWidth, primaryColor, primaryColorHover, }: NHDefaultPopupData) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
- import React, { useMemo } from 'react';
2
- import { Image, getLinkProps } from '@doyourjob/gravity-ui-page-constructor';
1
+ import React, { useContext, useMemo } from 'react';
2
+ import { HeaderStockContext, Image, getLinkProps } from '@doyourjob/gravity-ui-page-constructor';
3
3
  import { block } from '../../../../utils/cn';
4
4
  import { NHPopupItem } from '../NHPopupItem/NHPopupItem';
5
5
  import './NHDefaultPopup.css';
@@ -15,7 +15,19 @@ const NHEventCard = ({ title, caption, description, image, url }) => (React.crea
15
15
  React.createElement("div", { className: b('card-caption') }, caption),
16
16
  React.createElement("div", { className: b('card-title') }, title),
17
17
  React.createElement("div", { className: b('card-description') }, description))));
18
- export const NHDefaultPopup = ({ sections, right, maxWidth }) => {
18
+ const NHStock = ({ background }) => {
19
+ const data = useContext(HeaderStockContext);
20
+ if (!data.price)
21
+ return null;
22
+ return (React.createElement("div", { className: b('stock') },
23
+ background ? (React.createElement("img", { className: b('stock-background'), src: background, alt: "Stock background" })) : null,
24
+ React.createElement("div", { className: b('stock-title') }, data.price.name),
25
+ React.createElement("div", { className: b('stock-title') }, data.price.percent),
26
+ React.createElement("div", { className: b('stock-value') }, data.price.price),
27
+ React.createElement("div", { className: b('stock-date') }, data.price.update),
28
+ React.createElement("div", { className: b('stock-date') }, data.price.delayed)));
29
+ };
30
+ export const NHDefaultPopup = ({ sections, right, maxWidth, primaryColor, primaryColorHover, }) => {
19
31
  const rootStyle = useMemo(() => maxWidth
20
32
  ? {
21
33
  marginLeft: 'auto',
@@ -39,13 +51,9 @@ export const NHDefaultPopup = ({ sections, right, maxWidth }) => {
39
51
  section.title || section.subtitle ? (React.createElement("div", { className: b('head') },
40
52
  React.createElement("div", { className: b('title') }, section.title),
41
53
  React.createElement("div", { className: b('subtitle') }, section.subtitle))) : null,
42
- React.createElement("div", { className: b('wrap'), style: wrapsStyle[index] }, section.items.map((item) => (React.createElement(NHPopupItem, Object.assign({ key: item.title }, item))))))))),
54
+ React.createElement("div", { className: b('wrap'), style: wrapsStyle[index] }, section.items.map((item) => (React.createElement(NHPopupItem, Object.assign({ key: item.title }, item, { imageColor: primaryColor, imageColorHover: primaryColorHover }))))))))),
43
55
  right && (React.createElement("div", { className: b('right') },
44
56
  React.createElement("div", { className: b('title') }, right.title),
45
57
  cards && React.createElement("div", { className: b('cards') }, cards),
46
- right.stock && (React.createElement("div", { className: b('stock') },
47
- right.stock.background ? (React.createElement("img", { className: b('stock-background'), src: right.stock.background, alt: "Stock background" })) : null,
48
- React.createElement("div", { className: b('stock-title') }, right.stock.title),
49
- React.createElement("div", { className: b('stock-value') }, right.stock.value),
50
- React.createElement("div", { className: b('stock-date') }, right.stock.date)))))));
58
+ right.stock && React.createElement(NHStock, { background: right.stockImage })))));
51
59
  };
@@ -88,6 +88,16 @@ unpredictable css rules order in build */
88
88
  height: 24px;
89
89
  }
90
90
 
91
+ @media (max-width: 769px) {
92
+ .pc-addons-nh-navigation-popup-item__image_desktop {
93
+ display: none;
94
+ }
95
+ }
96
+ @media (min-width: 770px) {
97
+ .pc-addons-nh-navigation-popup-item__image_mobile {
98
+ display: none;
99
+ }
100
+ }
91
101
  .pc-addons-nh-navigation-popup-item__image-container {
92
102
  padding: 8px;
93
103
  border-radius: 8px;
@@ -6,11 +6,13 @@ import { ArrowRight } from './ArrowRight';
6
6
  import './NHPopupItem.css';
7
7
  const b = block('nh-navigation-popup-item');
8
8
  export const NHPopupItem = (props) => {
9
- const { url, target, title, description, image, imageColor, imageColorHover, column } = props;
9
+ const { url, target, title, description, image, imageMobile, imageColor, imageColorHover, column, } = props;
10
10
  const styleImageContainer = useMemo(() => (Object.assign(Object.assign({}, (imageColor ? { '--nh-popup-item-color': imageColor } : {})), (imageColorHover ? { '--nh-popup-item-color-hover': imageColorHover } : {}))), [imageColor, imageColorHover]);
11
+ const hasImage = image || imageMobile;
11
12
  return (React.createElement("a", Object.assign({ className: b({ disable: !url, column }), href: url }, getLinkProps(url || '', undefined, target)),
12
- image && (React.createElement("div", { className: b('image-container', { 'no-bg': !imageColor }), style: styleImageContainer },
13
- React.createElement(Image, { className: b('image'), src: image }))),
13
+ hasImage && (React.createElement("div", { className: b('image-container', { 'no-bg': !imageColor }), style: styleImageContainer },
14
+ image && (React.createElement(Image, { className: b('image', { desktop: Boolean(imageMobile) }), src: image })),
15
+ imageMobile && (React.createElement(Image, { className: b('image', { mobile: true }), src: imageMobile })))),
14
16
  React.createElement("div", { className: b('container') },
15
17
  React.createElement("div", { className: b('title') },
16
18
  title,
@@ -15,6 +15,7 @@ export interface NHPopupItemData {
15
15
  slug?: string;
16
16
  description?: string;
17
17
  image?: string | null;
18
+ imageMobile?: string | null;
18
19
  imageColor?: string;
19
20
  imageColorHover?: string;
20
21
  target?: string;
@@ -65,20 +66,17 @@ export interface NHEventCardData {
65
66
  image: string;
66
67
  url: string;
67
68
  }
68
- export interface NHStockData {
69
- title: string;
70
- value: string;
71
- date: string;
72
- background?: string;
73
- }
74
69
  export interface NHDefaultPopupData {
75
70
  sections: NHDefaultPopupSection[];
76
71
  maxWidth?: number;
72
+ primaryColor?: string;
73
+ primaryColorHover?: string;
77
74
  right?: {
78
75
  title: string;
79
76
  stories?: NHStoryCardData[];
80
77
  events?: NHEventCardData[];
81
- stock?: NHStockData;
78
+ stock?: boolean;
79
+ stockImage?: string;
82
80
  };
83
81
  }
84
82
  export interface NHLoginItemData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doyourjob/gravity-ui-page-constructor-addons",
3
- "version": "2.1.32",
3
+ "version": "2.1.33",
4
4
  "description": "Components and plugins for @doyourjob/gravity-ui-page-constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -72,7 +72,7 @@
72
72
  "react-transition-group": "^4.4.5"
73
73
  },
74
74
  "peerDependencies": {
75
- "@doyourjob/gravity-ui-page-constructor": "^5.31.32",
75
+ "@doyourjob/gravity-ui-page-constructor": "^5.31.256",
76
76
  "@gravity-ui/uikit": "^6.23.1",
77
77
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0"
78
78
  },