@cntrl-site/sdk-nextjs 0.8.0 → 0.8.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.
Binary file
Binary file
@@ -4,7 +4,7 @@ exports.LinkWrapper = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const LinkWrapper = ({ url, children }) => {
6
6
  const validUrl = url && buildValidUrl(url);
7
- return url ? ((0, jsx_runtime_1.jsx)("a", { href: validUrl, target: url.startsWith('/') ? '_self' : '_blank', rel: "noreferrer", children: children })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
7
+ return url ? ((0, jsx_runtime_1.jsx)("a", { href: validUrl, target: url.startsWith('/') || url.startsWith('#') ? '_self' : '_blank', rel: "noreferrer", children: children })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
8
8
  };
9
9
  exports.LinkWrapper = LinkWrapper;
10
10
  function buildValidUrl(url) {
@@ -22,7 +22,7 @@ const Section = ({ section, children }) => {
22
22
  }`;
23
23
  }, '');
24
24
  };
25
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `section-${section.id}`, style: {
25
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `section-${section.id}`, id: section.name, style: {
26
26
  backgroundColor: backgroundColor
27
27
  }, children: children }), (0, jsx_runtime_1.jsx)("style", { jsx: true, children: `
28
28
  ${(0, sdk_1.getLayoutStyles)(layouts, [section.height], ([height]) => (`
@@ -60,6 +60,7 @@ class RichTextConverter {
60
60
  text-align: ${ta};
61
61
  white-space: normal;
62
62
  overflow-wrap: break-word;
63
+ ${!hasPreset && 'line-height: 0;'}
63
64
  }
64
65
  `);
65
66
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.js",
@@ -10,7 +10,7 @@ export const LinkWrapper: React.FC<Props> = ({ url, children }) => {
10
10
  return url ? (
11
11
  <a
12
12
  href={validUrl}
13
- target={url.startsWith('/') ? '_self' : '_blank'}
13
+ target={url.startsWith('/') || url.startsWith('#') ? '_self' : '_blank'}
14
14
  rel="noreferrer"
15
15
  >
16
16
  {children}
@@ -4,8 +4,7 @@ import {
4
4
  getLayoutStyles,
5
5
  TArticleSection,
6
6
  TSectionHeight,
7
- SectionHeightMode,
8
- CntrlColor
7
+ SectionHeightMode
9
8
  } from '@cntrl-site/sdk';
10
9
  import { useCntrlContext } from '../provider/useCntrlContext';
11
10
  import { useSectionColor } from './useSectionColor';
@@ -39,6 +38,7 @@ export const Section: FC<Props> = ({ section, children }) => {
39
38
  <>
40
39
  <div
41
40
  className={`section-${section.id}`}
41
+ id={section.name}
42
42
  style={{
43
43
  backgroundColor: backgroundColor
44
44
  }}
@@ -90,6 +90,7 @@ export class RichTextConverter {
90
90
  text-align: ${ta};
91
91
  white-space: normal;
92
92
  overflow-wrap: break-word;
93
+ ${!hasPreset && 'line-height: 0;'}
93
94
  }
94
95
  `);
95
96
  });