@gravity-ui/blog-constructor 8.0.0-beta.0 → 8.0.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.
@@ -19,7 +19,6 @@ unpredictable css rules order in build */
19
19
  }
20
20
  .bc-post-card__header_fullWidth {
21
21
  min-height: auto;
22
- height: 100%;
23
22
  }
24
23
  @media (min-width: 1081px) {
25
24
  .bc-post-card__header_fullWidth {
@@ -4,10 +4,12 @@ unpredictable css rules order in build */
4
4
  font-size: var(--g-text-body-2-font-size);
5
5
  line-height: var(--g-text-body-2-line-height);
6
6
  display: flex;
7
- padding-right: 24px;
8
- padding-top: 12px;
9
7
  flex-wrap: nowrap;
10
8
  align-items: center;
9
+ margin-top: 12px;
10
+ }
11
+ .bc-post-info__item:not(:last-child) {
12
+ margin-right: 24px;
11
13
  }
12
14
  .bc-post-info__item_size_s {
13
15
  font-size: var(--g-text-body-2-font-size);
@@ -18,21 +20,16 @@ unpredictable css rules order in build */
18
20
  line-height: var(--g-text-body-3-line-height);
19
21
  }
20
22
  .bc-post-info__item_save {
23
+ padding: 0;
21
24
  background: none;
22
25
  color: inherit;
23
26
  border: none;
24
- padding: 0;
25
- font: inherit;
27
+ font-family: inherit;
28
+ font-weight: inherit;
26
29
  cursor: pointer;
27
30
  }
28
- .bc-post-info__item:last-child {
29
- font-size: var(--g-text-body-2-font-size);
30
- line-height: var(--g-text-body-2-line-height);
31
- display: flex;
32
- padding-right: 0px;
33
- padding-top: 12px;
34
- flex-wrap: nowrap;
35
- align-items: center;
31
+ .bc-post-info__item_extra:hover {
32
+ color: var(--g-color-text-primary);
36
33
  }
37
34
  .bc-post-info__switcher {
38
35
  color: var(--g-color-text-secondary);
@@ -62,6 +59,9 @@ unpredictable css rules order in build */
62
59
  .bc-post-info__container_theme_dark {
63
60
  color: var(--g-color-text-light-secondary);
64
61
  }
62
+ .bc-post-info__container_theme_dark .bc-post-info__item_extra:hover {
63
+ color: var(--g-color-text-light-primary);
64
+ }
65
65
  .bc-post-info__icon {
66
66
  margin-right: 6px;
67
67
  display: flex;
@@ -93,4 +93,5 @@ unpredictable css rules order in build */
93
93
  display: flex;
94
94
  flex-grow: 1;
95
95
  flex-wrap: wrap;
96
+ padding-right: 12px;
96
97
  }
@@ -1,5 +1,9 @@
1
+ import * as React from 'react';
1
2
  import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
2
3
  import { PostData, QAProps } from "../../models/common.js";
4
+ export type CustomInfoItemComponent = React.ComponentType<{
5
+ post: PostData;
6
+ }>;
3
7
  type PostInfoProps = QAProps & {
4
8
  postId: PostData['id'];
5
9
  readingTime: PostData['readingTime'];
@@ -11,6 +11,7 @@ const ReadingTime_1 = require("./components/ReadingTime.js");
11
11
  const Save_1 = require("./components/Save.js");
12
12
  const Sharing_1 = require("./components/Sharing.js");
13
13
  const common_1 = require("../../utils/common.js");
14
+ const SettingsContext_1 = require("../../contexts/SettingsContext.js");
14
15
  const b = (0, cn_1.block)('post-info');
15
16
  /**
16
17
  * Blog post info panel component
@@ -25,9 +26,10 @@ const b = (0, cn_1.block)('post-info');
25
26
  * @returns jsx
26
27
  */
27
28
  const PostInfo = ({ date, readingTime, postId, theme = 'light', qa, analyticsEventsContainer, }) => {
28
- const { likes } = React.useContext(PostPageContext_1.PostPageContext);
29
+ const { post, likes } = React.useContext(PostPageContext_1.PostPageContext);
30
+ const { extraInfoItems } = React.useContext(SettingsContext_1.SettingsContext);
29
31
  const qaAttributes = (0, common_1.getQaAttributes)(qa, 'date', 'reading-time', 'save');
30
- return ((0, jsx_runtime_1.jsxs)("div", { className: b('container', { theme }), children: [date && (0, jsx_runtime_1.jsx)(Date_1.Date, { date: date, qa: qaAttributes.date }), readingTime && (0, jsx_runtime_1.jsx)(ReadingTime_1.ReadingTime, { readingTime: readingTime, qa: qaAttributes.readingTime }), (0, jsx_runtime_1.jsx)(Sharing_1.Sharing, { theme: theme, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.sharing }), likes && ((0, jsx_runtime_1.jsx)(Save_1.Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.save, theme: theme, qa: qaAttributes.save }))] }));
32
+ return ((0, jsx_runtime_1.jsxs)("div", { className: b('container', { theme }), children: [date && (0, jsx_runtime_1.jsx)(Date_1.Date, { date: date, qa: qaAttributes.date }), readingTime && (0, jsx_runtime_1.jsx)(ReadingTime_1.ReadingTime, { readingTime: readingTime, qa: qaAttributes.readingTime }), (0, jsx_runtime_1.jsx)(Sharing_1.Sharing, { theme: theme, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.sharing }), likes && ((0, jsx_runtime_1.jsx)(Save_1.Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.save, theme: theme, qa: qaAttributes.save })), extraInfoItems === null || extraInfoItems === void 0 ? void 0 : extraInfoItems.map((Component, index) => ((0, jsx_runtime_1.jsx)("div", { className: b('item', { extra: true }), children: (0, jsx_runtime_1.jsx)(Component, { post: post }) }, index)))] }));
31
33
  };
32
34
  exports.PostInfo = PostInfo;
33
35
  //# sourceMappingURL=PostInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostInfo.js","sourceRoot":"../../../../src","sources":["components/PostInfo/PostInfo.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAG/B,uEAA+D;AAE/D,0CAAqC;AAErC,+CAAuC;AACvC,6DAAqD;AACrD,+CAAuC;AACvC,qDAA6C;AAC7C,kDAAmD;AAInD,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,WAAW,CAAC,CAAC;AAU7B;;;;;;;;;;;GAWG;AACI,MAAM,QAAQ,GAAG,CAAC,EACrB,IAAI,EACJ,WAAW,EACX,MAAM,EACN,KAAK,GAAG,OAAO,EACf,EAAE,EACF,wBAAwB,GACZ,EAAE,EAAE;IAChB,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iCAAe,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAEzE,OAAO,CACH,iCAAK,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,EAAC,KAAK,EAAC,CAAC,aAClC,IAAI,IAAI,uBAAC,WAAI,IAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,IAAI,GAAI,EACnD,WAAW,IAAI,uBAAC,yBAAW,IAAC,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,YAAY,CAAC,WAAW,GAAI,EACvF,uBAAC,iBAAO,IAAC,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,OAAO,GAAI,EAC5E,KAAK,IAAI,CACN,uBAAC,WAAI,IACD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,CAAC,UAAU,EACvB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,IAAI,EAC/C,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,YAAY,CAAC,IAAI,GACvB,CACL,IACC,CACT,CAAC;AACN,CAAC,CAAC;AA7BW,QAAA,QAAQ,YA6BnB","sourcesContent":["import * as React from 'react';\n\nimport {AnalyticsEventsProp} from '@gravity-ui/page-constructor';\nimport {PostPageContext} from '../../contexts/PostPageContext';\nimport {PostData, QAProps} from '../../models/common';\nimport {block} from '../../utils/cn';\n\nimport {Date} from './components/Date';\nimport {ReadingTime} from './components/ReadingTime';\nimport {Save} from './components/Save';\nimport {Sharing} from './components/Sharing';\nimport {getQaAttributes} from '../../utils/common';\n\nimport './PostInfo.scss';\n\nconst b = block('post-info');\n\ntype PostInfoProps = QAProps & {\n postId: PostData['id'];\n readingTime: PostData['readingTime'];\n date: PostData['date'];\n theme?: 'light' | 'dark';\n analyticsEventsContainer?: Record<string, AnalyticsEventsProp>;\n};\n\n/**\n * Blog post info panel component\n *\n * @param postId - post id\n * @param readingTime - post reading time\n * @param date - post create date\n * @param theme - theme name\n * @param qa - test-attr\n * @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events\n *\n * @returns jsx\n */\nexport const PostInfo = ({\n date,\n readingTime,\n postId,\n theme = 'light',\n qa,\n analyticsEventsContainer,\n}: PostInfoProps) => {\n const {likes} = React.useContext(PostPageContext);\n const qaAttributes = getQaAttributes(qa, 'date', 'reading-time', 'save');\n\n return (\n <div className={b('container', {theme})}>\n {date && <Date date={date} qa={qaAttributes.date} />}\n {readingTime && <ReadingTime readingTime={readingTime} qa={qaAttributes.readingTime} />}\n <Sharing theme={theme} analyticsEvents={analyticsEventsContainer?.sharing} />\n {likes && (\n <Save\n postId={postId}\n title={likes.likesCount}\n hasUserLike={likes.hasUserLike}\n handleUserLike={likes.handleUserLike}\n analyticsEvents={analyticsEventsContainer?.save}\n theme={theme}\n qa={qaAttributes.save}\n />\n )}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"PostInfo.js","sourceRoot":"../../../../src","sources":["components/PostInfo/PostInfo.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAG/B,uEAA+D;AAE/D,0CAAqC;AAErC,+CAAuC;AACvC,6DAAqD;AACrD,+CAAuC;AACvC,qDAA6C;AAC7C,kDAAmD;AAGnD,uEAA+D;AAE/D,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,WAAW,CAAC,CAAC;AAY7B;;;;;;;;;;;GAWG;AACI,MAAM,QAAQ,GAAG,CA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E,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,YAChD,uBAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,IADnB,KAAK,CAET,CACT,CAAC,IACA,CACT,CAAC;AACN,CAAC,CAAC;AAnCW,QAAA,QAAQ,YAmCnB","sourcesContent":["import * as React from 'react';\n\nimport {AnalyticsEventsProp} from '@gravity-ui/page-constructor';\nimport {PostPageContext} from '../../contexts/PostPageContext';\nimport {PostData, QAProps} from '../../models/common';\nimport {block} from '../../utils/cn';\n\nimport {Date} from './components/Date';\nimport {ReadingTime} from './components/ReadingTime';\nimport {Save} from './components/Save';\nimport {Sharing} from './components/Sharing';\nimport {getQaAttributes} from '../../utils/common';\n\nimport './PostInfo.scss';\nimport {SettingsContext} from '../../contexts/SettingsContext';\n\nconst b = block('post-info');\n\nexport type CustomInfoItemComponent = React.ComponentType<{post: PostData}>;\n\ntype PostInfoProps = QAProps & {\n postId: PostData['id'];\n readingTime: PostData['readingTime'];\n date: PostData['date'];\n theme?: 'light' | 'dark';\n analyticsEventsContainer?: Record<string, AnalyticsEventsProp>;\n};\n\n/**\n * Blog post info panel component\n *\n * @param postId - post id\n * @param readingTime - post reading time\n * @param date - post create date\n * @param theme - theme name\n * @param qa - test-attr\n * @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events\n *\n * @returns jsx\n */\nexport const PostInfo = ({\n date,\n readingTime,\n postId,\n theme = 'light',\n qa,\n analyticsEventsContainer,\n}: PostInfoProps) => {\n const {post, likes} = React.useContext(PostPageContext);\n const {extraInfoItems} = React.useContext(SettingsContext);\n const qaAttributes = getQaAttributes(qa, 'date', 'reading-time', 'save');\n\n return (\n <div className={b('container', {theme})}>\n {date && <Date date={date} qa={qaAttributes.date} />}\n {readingTime && <ReadingTime readingTime={readingTime} qa={qaAttributes.readingTime} />}\n <Sharing theme={theme} analyticsEvents={analyticsEventsContainer?.sharing} />\n {likes && (\n <Save\n postId={postId}\n title={likes.likesCount}\n hasUserLike={likes.hasUserLike}\n handleUserLike={likes.handleUserLike}\n analyticsEvents={analyticsEventsContainer?.save}\n theme={theme}\n qa={qaAttributes.save}\n />\n )}\n {extraInfoItems?.map((Component, index) => (\n <div key={index} className={b('item', {extra: true})}>\n <Component post={post} />\n </div>\n ))}\n </div>\n );\n};\n"]}
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { CustomInfoItemComponent } from "../components/PostInfo/PostInfo.js";
2
3
  export interface SettingsContextProps {
3
4
  addNavigationLinkForPages?: boolean;
4
5
  isAnimationEnabled?: boolean;
5
6
  getBlogPath?: (pathPrefix: string) => string;
7
+ extraInfoItems?: CustomInfoItemComponent[];
6
8
  }
7
9
  export declare const SettingsContext: React.Context<SettingsContextProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsContext.js","sourceRoot":"../../../src","sources":["contexts/SettingsContext.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AASlB,QAAA,eAAe,GAAG,KAAK,CAAC,aAAa,CAAuB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nexport interface SettingsContextProps {\n addNavigationLinkForPages?: boolean;\n isAnimationEnabled?: boolean;\n\n getBlogPath?: (pathPrefix: string) => string;\n}\n\nexport const SettingsContext = React.createContext<SettingsContextProps>({});\n"]}
1
+ {"version":3,"file":"SettingsContext.js","sourceRoot":"../../../src","sources":["contexts/SettingsContext.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAWlB,QAAA,eAAe,GAAG,KAAK,CAAC,aAAa,CAAuB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {CustomInfoItemComponent} from '../components/PostInfo/PostInfo';\n\nexport interface SettingsContextProps {\n addNavigationLinkForPages?: boolean;\n isAnimationEnabled?: boolean;\n\n getBlogPath?: (pathPrefix: string) => string;\n extraInfoItems?: CustomInfoItemComponent[];\n}\n\nexport const SettingsContext = React.createContext<SettingsContextProps>({});\n"]}
@@ -19,7 +19,6 @@ unpredictable css rules order in build */
19
19
  }
20
20
  .bc-post-card__header_fullWidth {
21
21
  min-height: auto;
22
- height: 100%;
23
22
  }
24
23
  @media (min-width: 1081px) {
25
24
  .bc-post-card__header_fullWidth {
@@ -4,10 +4,12 @@ unpredictable css rules order in build */
4
4
  font-size: var(--g-text-body-2-font-size);
5
5
  line-height: var(--g-text-body-2-line-height);
6
6
  display: flex;
7
- padding-right: 24px;
8
- padding-top: 12px;
9
7
  flex-wrap: nowrap;
10
8
  align-items: center;
9
+ margin-top: 12px;
10
+ }
11
+ .bc-post-info__item:not(:last-child) {
12
+ margin-right: 24px;
11
13
  }
12
14
  .bc-post-info__item_size_s {
13
15
  font-size: var(--g-text-body-2-font-size);
@@ -18,21 +20,16 @@ unpredictable css rules order in build */
18
20
  line-height: var(--g-text-body-3-line-height);
19
21
  }
20
22
  .bc-post-info__item_save {
23
+ padding: 0;
21
24
  background: none;
22
25
  color: inherit;
23
26
  border: none;
24
- padding: 0;
25
- font: inherit;
27
+ font-family: inherit;
28
+ font-weight: inherit;
26
29
  cursor: pointer;
27
30
  }
28
- .bc-post-info__item:last-child {
29
- font-size: var(--g-text-body-2-font-size);
30
- line-height: var(--g-text-body-2-line-height);
31
- display: flex;
32
- padding-right: 0px;
33
- padding-top: 12px;
34
- flex-wrap: nowrap;
35
- align-items: center;
31
+ .bc-post-info__item_extra:hover {
32
+ color: var(--g-color-text-primary);
36
33
  }
37
34
  .bc-post-info__switcher {
38
35
  color: var(--g-color-text-secondary);
@@ -62,6 +59,9 @@ unpredictable css rules order in build */
62
59
  .bc-post-info__container_theme_dark {
63
60
  color: var(--g-color-text-light-secondary);
64
61
  }
62
+ .bc-post-info__container_theme_dark .bc-post-info__item_extra:hover {
63
+ color: var(--g-color-text-light-primary);
64
+ }
65
65
  .bc-post-info__icon {
66
66
  margin-right: 6px;
67
67
  display: flex;
@@ -93,4 +93,5 @@ unpredictable css rules order in build */
93
93
  display: flex;
94
94
  flex-grow: 1;
95
95
  flex-wrap: wrap;
96
+ padding-right: 12px;
96
97
  }
@@ -1,6 +1,10 @@
1
+ import * as React from 'react';
1
2
  import { AnalyticsEventsProp } from '@gravity-ui/page-constructor';
2
3
  import { PostData, QAProps } from "../../models/common.js";
3
4
  import './PostInfo.css';
5
+ export type CustomInfoItemComponent = React.ComponentType<{
6
+ post: PostData;
7
+ }>;
4
8
  type PostInfoProps = QAProps & {
5
9
  postId: PostData['id'];
6
10
  readingTime: PostData['readingTime'];
@@ -8,6 +8,7 @@ import { Save } from "./components/Save.js";
8
8
  import { Sharing } from "./components/Sharing.js";
9
9
  import { getQaAttributes } from "../../utils/common.js";
10
10
  import './PostInfo.css';
11
+ import { SettingsContext } from "../../contexts/SettingsContext.js";
11
12
  const b = block('post-info');
12
13
  /**
13
14
  * Blog post info panel component
@@ -22,8 +23,9 @@ const b = block('post-info');
22
23
  * @returns jsx
23
24
  */
24
25
  export const PostInfo = ({ date, readingTime, postId, theme = 'light', qa, analyticsEventsContainer, }) => {
25
- const { likes } = React.useContext(PostPageContext);
26
+ const { post, likes } = React.useContext(PostPageContext);
27
+ const { extraInfoItems } = React.useContext(SettingsContext);
26
28
  const qaAttributes = getQaAttributes(qa, 'date', 'reading-time', 'save');
27
- return (_jsxs("div", { className: b('container', { theme }), children: [date && _jsx(Date, { date: date, qa: qaAttributes.date }), readingTime && _jsx(ReadingTime, { readingTime: readingTime, qa: qaAttributes.readingTime }), _jsx(Sharing, { theme: theme, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.sharing }), likes && (_jsx(Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.save, theme: theme, qa: qaAttributes.save }))] }));
29
+ return (_jsxs("div", { className: b('container', { theme }), children: [date && _jsx(Date, { date: date, qa: qaAttributes.date }), readingTime && _jsx(ReadingTime, { readingTime: readingTime, qa: qaAttributes.readingTime }), _jsx(Sharing, { theme: theme, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.sharing }), likes && (_jsx(Save, { postId: postId, title: likes.likesCount, hasUserLike: likes.hasUserLike, handleUserLike: likes.handleUserLike, analyticsEvents: analyticsEventsContainer === null || analyticsEventsContainer === void 0 ? void 0 : analyticsEventsContainer.save, theme: theme, qa: qaAttributes.save })), extraInfoItems === null || extraInfoItems === void 0 ? void 0 : extraInfoItems.map((Component, index) => (_jsx("div", { className: b('item', { extra: true }), children: _jsx(Component, { post: post }) }, index)))] }));
28
30
  };
29
31
  //# sourceMappingURL=PostInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostInfo.js","sourceRoot":"../../../../src","sources":["components/PostInfo/PostInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAE/D,OAAO,EAAC,KAAK,EAAC,0BAAuB;AAErC,OAAO,EAAC,IAAI,EAAC,6BAA0B;AACvC,OAAO,EAAC,WAAW,EAAC,oCAAiC;AACrD,OAAO,EAAC,IAAI,EAAC,6BAA0B;AACvC,OAAO,EAAC,OAAO,EAAC,gCAA6B;AAC7C,OAAO,EAAC,eAAe,EAAC,8BAA2B;AAEnD,OAAO,gBAAgB,CAAC;AAExB,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;AAU7B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACrB,IAAI,EACJ,WAAW,EACX,MAAM,EACN,KAAK,GAAG,OAAO,EACf,EAAE,EACF,wBAAwB,GACZ,EAAE,EAAE;IAChB,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAEzE,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,EAAC,KAAK,EAAC,CAAC,aAClC,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,IAAI,GAAI,EACnD,WAAW,IAAI,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,YAAY,CAAC,WAAW,GAAI,EACvF,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,OAAO,GAAI,EAC5E,KAAK,IAAI,CACN,KAAC,IAAI,IACD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,CAAC,UAAU,EACvB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,IAAI,EAC/C,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,YAAY,CAAC,IAAI,GACvB,CACL,IACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {AnalyticsEventsProp} from '@gravity-ui/page-constructor';\nimport {PostPageContext} from '../../contexts/PostPageContext';\nimport {PostData, QAProps} from '../../models/common';\nimport {block} from '../../utils/cn';\n\nimport {Date} from './components/Date';\nimport {ReadingTime} from './components/ReadingTime';\nimport {Save} from './components/Save';\nimport {Sharing} from './components/Sharing';\nimport {getQaAttributes} from '../../utils/common';\n\nimport './PostInfo.scss';\n\nconst b = block('post-info');\n\ntype PostInfoProps = QAProps & {\n postId: PostData['id'];\n readingTime: PostData['readingTime'];\n date: PostData['date'];\n theme?: 'light' | 'dark';\n analyticsEventsContainer?: Record<string, AnalyticsEventsProp>;\n};\n\n/**\n * Blog post info panel component\n *\n * @param postId - post id\n * @param readingTime - post reading time\n * @param date - post create date\n * @param theme - theme name\n * @param qa - test-attr\n * @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events\n *\n * @returns jsx\n */\nexport const PostInfo = ({\n date,\n readingTime,\n postId,\n theme = 'light',\n qa,\n analyticsEventsContainer,\n}: PostInfoProps) => {\n const {likes} = React.useContext(PostPageContext);\n const qaAttributes = getQaAttributes(qa, 'date', 'reading-time', 'save');\n\n return (\n <div className={b('container', {theme})}>\n {date && <Date date={date} qa={qaAttributes.date} />}\n {readingTime && <ReadingTime readingTime={readingTime} qa={qaAttributes.readingTime} />}\n <Sharing theme={theme} analyticsEvents={analyticsEventsContainer?.sharing} />\n {likes && (\n <Save\n postId={postId}\n title={likes.likesCount}\n hasUserLike={likes.hasUserLike}\n handleUserLike={likes.handleUserLike}\n analyticsEvents={analyticsEventsContainer?.save}\n theme={theme}\n qa={qaAttributes.save}\n />\n )}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"PostInfo.js","sourceRoot":"../../../../src","sources":["components/PostInfo/PostInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAE/D,OAAO,EAAC,KAAK,EAAC,0BAAuB;AAErC,OAAO,EAAC,IAAI,EAAC,6BAA0B;AACvC,OAAO,EAAC,WAAW,EAAC,oCAAiC;AACrD,OAAO,EAAC,IAAI,EAAC,6BAA0B;AACvC,OAAO,EAAC,OAAO,EAAC,gCAA6B;AAC7C,OAAO,EAAC,eAAe,EAAC,8BAA2B;AAEnD,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAE/D,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;AAY7B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACrB,IAAI,EACJ,WAAW,EACX,MAAM,EACN,KAAK,GAAG,OAAO,EACf,EAAE,E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KAAK,CAET,CACT,CAAC,IACA,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {AnalyticsEventsProp} from '@gravity-ui/page-constructor';\nimport {PostPageContext} from '../../contexts/PostPageContext';\nimport {PostData, QAProps} from '../../models/common';\nimport {block} from '../../utils/cn';\n\nimport {Date} from './components/Date';\nimport {ReadingTime} from './components/ReadingTime';\nimport {Save} from './components/Save';\nimport {Sharing} from './components/Sharing';\nimport {getQaAttributes} from '../../utils/common';\n\nimport './PostInfo.scss';\nimport {SettingsContext} from '../../contexts/SettingsContext';\n\nconst b = block('post-info');\n\nexport type CustomInfoItemComponent = React.ComponentType<{post: PostData}>;\n\ntype PostInfoProps = QAProps & {\n postId: PostData['id'];\n readingTime: PostData['readingTime'];\n date: PostData['date'];\n theme?: 'light' | 'dark';\n analyticsEventsContainer?: Record<string, AnalyticsEventsProp>;\n};\n\n/**\n * Blog post info panel component\n *\n * @param postId - post id\n * @param readingTime - post reading time\n * @param date - post create date\n * @param theme - theme name\n * @param qa - test-attr\n * @param analyticsEventsContainer - a map of records with a single or collection of objects detailing analytics events\n *\n * @returns jsx\n */\nexport const PostInfo = ({\n date,\n readingTime,\n postId,\n theme = 'light',\n qa,\n analyticsEventsContainer,\n}: PostInfoProps) => {\n const {post, likes} = React.useContext(PostPageContext);\n const {extraInfoItems} = React.useContext(SettingsContext);\n const qaAttributes = getQaAttributes(qa, 'date', 'reading-time', 'save');\n\n return (\n <div className={b('container', {theme})}>\n {date && <Date date={date} qa={qaAttributes.date} />}\n {readingTime && <ReadingTime readingTime={readingTime} qa={qaAttributes.readingTime} />}\n <Sharing theme={theme} analyticsEvents={analyticsEventsContainer?.sharing} />\n {likes && (\n <Save\n postId={postId}\n title={likes.likesCount}\n hasUserLike={likes.hasUserLike}\n handleUserLike={likes.handleUserLike}\n analyticsEvents={analyticsEventsContainer?.save}\n theme={theme}\n qa={qaAttributes.save}\n />\n )}\n {extraInfoItems?.map((Component, index) => (\n <div key={index} className={b('item', {extra: true})}>\n <Component post={post} />\n </div>\n ))}\n </div>\n );\n};\n"]}
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { CustomInfoItemComponent } from "../components/PostInfo/PostInfo.js";
2
3
  export interface SettingsContextProps {
3
4
  addNavigationLinkForPages?: boolean;
4
5
  isAnimationEnabled?: boolean;
5
6
  getBlogPath?: (pathPrefix: string) => string;
7
+ extraInfoItems?: CustomInfoItemComponent[];
6
8
  }
7
9
  export declare const SettingsContext: React.Context<SettingsContextProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsContext.js","sourceRoot":"../../../src","sources":["contexts/SettingsContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAuB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nexport interface SettingsContextProps {\n addNavigationLinkForPages?: boolean;\n isAnimationEnabled?: boolean;\n\n getBlogPath?: (pathPrefix: string) => string;\n}\n\nexport const SettingsContext = React.createContext<SettingsContextProps>({});\n"]}
1
+ {"version":3,"file":"SettingsContext.js","sourceRoot":"../../../src","sources":["contexts/SettingsContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAuB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {CustomInfoItemComponent} from '../components/PostInfo/PostInfo';\n\nexport interface SettingsContextProps {\n addNavigationLinkForPages?: boolean;\n isAnimationEnabled?: boolean;\n\n getBlogPath?: (pathPrefix: string) => string;\n extraInfoItems?: CustomInfoItemComponent[];\n}\n\nexport const SettingsContext = React.createContext<SettingsContextProps>({});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "8.0.0-beta.0",
3
+ "version": "8.0.0",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@bem-react/classname": "^1.6.0",
78
- "@gravity-ui/components": "^4.0.1",
78
+ "@gravity-ui/components": "^4.3.1",
79
79
  "@gravity-ui/gulp-utils": "^1.0.1",
80
80
  "@gravity-ui/i18n": "^1.7.0",
81
81
  "lodash": "^4.17.21",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "peerDependencies": {
89
89
  "@diplodoc/transform": "^4.10.7",
90
- "@gravity-ui/page-constructor": "^7.0.0-beta.0",
90
+ "@gravity-ui/page-constructor": "^7.0.0",
91
91
  "@gravity-ui/uikit": "^7.1.1",
92
92
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
93
93
  },
@@ -98,7 +98,8 @@
98
98
  "@commitlint/config-conventional": "^17.4.3",
99
99
  "@diplodoc/transform": "^4.10.8",
100
100
  "@gravity-ui/eslint-config": "^3.2.0",
101
- "@gravity-ui/page-constructor": "^7.0.0-beta.0",
101
+ "@gravity-ui/icons": "^2.13.0",
102
+ "@gravity-ui/page-constructor": "^7.0.0",
102
103
  "@gravity-ui/prettier-config": "^1.1.0",
103
104
  "@gravity-ui/stylelint-config": "^4.0.1",
104
105
  "@gravity-ui/tsconfig": "^1.0.0",