@gravity-ui/blog-constructor 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.1.1](https://github.com/gravity-ui/blog-constructor/compare/v3.1.0...v3.1.1) (2023-05-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add specificity to headings ([#43](https://github.com/gravity-ui/blog-constructor/issues/43)) ([de53d0b](https://github.com/gravity-ui/blog-constructor/commit/de53d0bb9a697f520626e8c0b1d8c48c8e4d8a64))
9
+ * change href 'prev' to 'blog' and 'next' to page+1 ([#42](https://github.com/gravity-ui/blog-constructor/issues/42)) ([cb8b810](https://github.com/gravity-ui/blog-constructor/commit/cb8b8102d59368cfa0d285d63604a8e9f1ab6619))
10
+
3
11
  ## [3.1.0](https://github.com/gravity-ui/blog-constructor/compare/v3.0.2...v3.1.0) (2023-04-25)
4
12
 
5
13
 
@@ -107,6 +107,7 @@ const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, loadin
107
107
  dataKey: types_1.ArrowType.Prev,
108
108
  mods: { type: types_1.ArrowType.Prev },
109
109
  onClick: handleArrowClick,
110
+ index: 0,
110
111
  content: react_1.default.createElement(NavigationButton_1.NavigationButton, { arrowType: types_1.ArrowType.Prev }),
111
112
  });
112
113
  }
@@ -115,6 +116,7 @@ const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className, loadin
115
116
  key: types_1.ArrowType.Next,
116
117
  dataKey: types_1.ArrowType.Next,
117
118
  mods: { type: types_1.ArrowType.Next },
119
+ index: page + 1,
118
120
  onClick: handleArrowClick,
119
121
  content: react_1.default.createElement(NavigationButton_1.NavigationButton, { arrowType: types_1.ArrowType.Next }),
120
122
  });
@@ -1,2 +1,2 @@
1
1
  import { PaginatorItemProps } from '../types';
2
- export declare const PaginatorItem: ({ dataKey, mods, content, onClick, loading, }: PaginatorItemProps) => JSX.Element;
2
+ export declare const PaginatorItem: ({ dataKey, mods, content, onClick, loading, index, }: PaginatorItemProps) => JSX.Element;
@@ -30,12 +30,12 @@ const LocaleContext_1 = require("../../../contexts/LocaleContext");
30
30
  const cn_1 = require("../../../utils/cn");
31
31
  const common_1 = require("../../../utils/common");
32
32
  const b = (0, cn_1.block)('paginator');
33
- const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
33
+ const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, index, }) => {
34
34
  const { locale } = (0, react_1.useContext)(LocaleContext_1.LocaleContext);
35
35
  const urlPath = (0, common_1.getBlogPath)((locale === null || locale === void 0 ? void 0 : locale.pathPrefix) || '');
36
36
  const itemKey = Number(dataKey) > 0 ? Number(dataKey) : dataKey;
37
- const navTag = itemKey > 0 ? `${mods.type || 'page'}=${itemKey}` : itemKey;
38
- const navigationLink = `${urlPath || ''}?${navTag}`;
37
+ const navTag = index > 1 ? `?page=${index}` : '';
38
+ const navigationLink = `${urlPath || ''}${navTag}`;
39
39
  return (react_1.default.createElement(uikit_1.Button, { view: "flat", size: "xl", className: b('item', mods), onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(itemKey), loading: loading && Boolean(mods.active) },
40
40
  react_1.default.createElement("a", { href: navigationLink, className: b('link'), onClick: (event) => event.preventDefault() }, content)));
41
41
  };
@@ -8,6 +8,7 @@ export interface PaginatorItemProps {
8
8
  content: ReactNode;
9
9
  onClick?: (key: number | ArrowType) => void;
10
10
  loading?: boolean;
11
+ index: number;
11
12
  }
12
13
  export type PaginatorProps = {
13
14
  page: number;
@@ -17,6 +17,7 @@ const getPageConfigs = ({ page, pagesCount, handlePageClick }) => {
17
17
  paginatorItems.push({
18
18
  key: String(i),
19
19
  dataKey: String(i),
20
+ index: i,
20
21
  mods: { type: 'page', active: page === i },
21
22
  onClick: handlePageClick,
22
23
  content: i,
@@ -49,17 +49,18 @@ unpredictable css rules order in build */
49
49
  font-size: var(--yc-text-header-1-font-size);
50
50
  line-height: var(--yc-text-header-1-line-height);
51
51
  }
52
- .yfm_blog h1,
53
- .yfm_blog h2,
54
- .yfm_blog h3,
55
- .yfm_blog h4,
56
- .yfm_blog h5,
57
- .yfm_blog h6 {
52
+ .yfm_blog.yfm_blog h1,
53
+ .yfm_blog.yfm_blog h2,
54
+ .yfm_blog.yfm_blog h3,
55
+ .yfm_blog.yfm_blog h4,
56
+ .yfm_blog.yfm_blog h5,
57
+ .yfm_blog.yfm_blog h6 {
58
58
  margin-bottom: 16px;
59
59
  margin-top: 32px;
60
60
  padding-top: 0;
61
61
  font-weight: var(--yc-text-header-font-weight);
62
62
  }
63
+
63
64
  .yfm_blog blockquote,
64
65
  .yfm_blog dl,
65
66
  .yfm_blog ol,
@@ -79,6 +79,7 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
79
79
  dataKey: ArrowType.Prev,
80
80
  mods: { type: ArrowType.Prev },
81
81
  onClick: handleArrowClick,
82
+ index: 0,
82
83
  content: React.createElement(NavigationButton, { arrowType: ArrowType.Prev }),
83
84
  });
84
85
  }
@@ -87,6 +88,7 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
87
88
  key: ArrowType.Next,
88
89
  dataKey: ArrowType.Next,
89
90
  mods: { type: ArrowType.Next },
91
+ index: page + 1,
90
92
  onClick: handleArrowClick,
91
93
  content: React.createElement(NavigationButton, { arrowType: ArrowType.Next }),
92
94
  });
@@ -1,3 +1,3 @@
1
1
  import { PaginatorItemProps } from '../types';
2
2
  import '../Paginator.css';
3
- export declare const PaginatorItem: ({ dataKey, mods, content, onClick, loading, }: PaginatorItemProps) => JSX.Element;
3
+ export declare const PaginatorItem: ({ dataKey, mods, content, onClick, loading, index, }: PaginatorItemProps) => JSX.Element;
@@ -5,12 +5,12 @@ import { block } from '../../../utils/cn';
5
5
  import { getBlogPath } from '../../../utils/common';
6
6
  import '../Paginator.css';
7
7
  const b = block('paginator');
8
- export const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
8
+ export const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, index, }) => {
9
9
  const { locale } = useContext(LocaleContext);
10
10
  const urlPath = getBlogPath((locale === null || locale === void 0 ? void 0 : locale.pathPrefix) || '');
11
11
  const itemKey = Number(dataKey) > 0 ? Number(dataKey) : dataKey;
12
- const navTag = itemKey > 0 ? `${mods.type || 'page'}=${itemKey}` : itemKey;
13
- const navigationLink = `${urlPath || ''}?${navTag}`;
12
+ const navTag = index > 1 ? `?page=${index}` : '';
13
+ const navigationLink = `${urlPath || ''}${navTag}`;
14
14
  return (React.createElement(Button, { view: "flat", size: "xl", className: b('item', mods), onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(itemKey), loading: loading && Boolean(mods.active) },
15
15
  React.createElement("a", { href: navigationLink, className: b('link'), onClick: (event) => event.preventDefault() }, content)));
16
16
  };
@@ -8,6 +8,7 @@ export interface PaginatorItemProps {
8
8
  content: ReactNode;
9
9
  onClick?: (key: number | ArrowType) => void;
10
10
  loading?: boolean;
11
+ index: number;
11
12
  }
12
13
  export type PaginatorProps = {
13
14
  page: number;
@@ -14,6 +14,7 @@ export const getPageConfigs = ({ page, pagesCount, handlePageClick }) => {
14
14
  paginatorItems.push({
15
15
  key: String(i),
16
16
  dataKey: String(i),
17
+ index: i,
17
18
  mods: { type: 'page', active: page === i },
18
19
  onClick: handlePageClick,
19
20
  content: i,
@@ -49,17 +49,18 @@ unpredictable css rules order in build */
49
49
  font-size: var(--yc-text-header-1-font-size);
50
50
  line-height: var(--yc-text-header-1-line-height);
51
51
  }
52
- .yfm_blog h1,
53
- .yfm_blog h2,
54
- .yfm_blog h3,
55
- .yfm_blog h4,
56
- .yfm_blog h5,
57
- .yfm_blog h6 {
52
+ .yfm_blog.yfm_blog h1,
53
+ .yfm_blog.yfm_blog h2,
54
+ .yfm_blog.yfm_blog h3,
55
+ .yfm_blog.yfm_blog h4,
56
+ .yfm_blog.yfm_blog h5,
57
+ .yfm_blog.yfm_blog h6 {
58
58
  margin-bottom: 16px;
59
59
  margin-top: 32px;
60
60
  padding-top: 0;
61
61
  font-weight: var(--yc-text-header-font-weight);
62
62
  }
63
+
63
64
  .yfm_blog blockquote,
64
65
  .yfm_blog dl,
65
66
  .yfm_blog ol,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
package/styles/yfm.css CHANGED
@@ -25,17 +25,18 @@ unpredictable css rules order in build */
25
25
  font-size: var(--yc-text-header-1-font-size);
26
26
  line-height: var(--yc-text-header-1-line-height);
27
27
  }
28
- .yfm_blog h1,
29
- .yfm_blog h2,
30
- .yfm_blog h3,
31
- .yfm_blog h4,
32
- .yfm_blog h5,
33
- .yfm_blog h6 {
28
+ .yfm_blog.yfm_blog h1,
29
+ .yfm_blog.yfm_blog h2,
30
+ .yfm_blog.yfm_blog h3,
31
+ .yfm_blog.yfm_blog h4,
32
+ .yfm_blog.yfm_blog h5,
33
+ .yfm_blog.yfm_blog h6 {
34
34
  margin-bottom: 16px;
35
35
  margin-top: 32px;
36
36
  padding-top: 0;
37
37
  font-weight: var(--yc-text-header-font-weight);
38
38
  }
39
+
39
40
  .yfm_blog blockquote,
40
41
  .yfm_blog dl,
41
42
  .yfm_blog ol,
package/styles/yfm.scss CHANGED
@@ -2,6 +2,8 @@
2
2
  @import './variables.scss';
3
3
 
4
4
  .yfm_blog {
5
+ $root: &;
6
+
5
7
  @include text-size(body-3);
6
8
  color: var(--yc-color-text-primary);
7
9
 
@@ -26,16 +28,18 @@
26
28
  @include text-size(header-1);
27
29
  }
28
30
 
29
- h1,
30
- h2,
31
- h3,
32
- h4,
33
- h5,
34
- h6 {
35
- margin-bottom: $indentXS;
36
- margin-top: $indentM;
37
- padding-top: 0;
38
- font-weight: var(--yc-text-header-font-weight);
31
+ @include add-specificity(&) {
32
+ h1,
33
+ h2,
34
+ h3,
35
+ h4,
36
+ h5,
37
+ h6 {
38
+ margin-bottom: $indentXS;
39
+ margin-top: $indentM;
40
+ padding-top: 0;
41
+ font-weight: var(--yc-text-header-font-weight);
42
+ }
39
43
  }
40
44
 
41
45
  blockquote,