@cntrl-site/sdk-nextjs 0.7.1 → 0.7.3
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/cntrl-site-sdk-nextjs-0.7.2.tgz +0 -0
- package/lib/components/items/RichTextItem.js +0 -2
- package/lib/components/items/useItemSticky.js +0 -3
- package/lib/utils/RichTextConverter/RichTextConverter.js +0 -1
- package/package.json +2 -2
- package/src/components/items/RichTextItem.tsx +1 -5
- package/src/components/items/useItemSticky.ts +0 -4
- package/src/utils/RichTextConverter/RichTextConverter.tsx +0 -1
- package/cntrl-site-sdk-nextjs-0.4.3.tgz +0 -0
- package/cntrl-site-sdk-nextjs-0.7.0.tgz +0 -0
- package/cntrl-site-sdk-nextjs-0.7.1.tgz +0 -0
|
Binary file
|
|
@@ -7,9 +7,7 @@ exports.RichTextItem = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
//@ts-ignore
|
|
9
9
|
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
10
|
-
const RichTextConverter_1 = require("../../utils/RichTextConverter/RichTextConverter");
|
|
11
10
|
const useRichTextItem_1 = require("./useRichTextItem");
|
|
12
|
-
const richTextConv = new RichTextConverter_1.RichTextConverter();
|
|
13
11
|
const RichTextItem = ({ item }) => {
|
|
14
12
|
const [content, styles, preset] = (0, useRichTextItem_1.useRichTextItem)(item);
|
|
15
13
|
const className = preset ? `cntrl-preset-${preset.id}` : undefined;
|
|
@@ -13,9 +13,6 @@ const useItemSticky = (top, parentOffsetTop, item) => {
|
|
|
13
13
|
const layoutId = (0, useCurrentLayout_1.useCurrentLayout)();
|
|
14
14
|
const sticky = (0, react_1.useMemo)(() => item.layoutParams[layoutId].sticky, [layoutId]);
|
|
15
15
|
const stickyManager = (0, react_1.useMemo)(() => new StickyManager_1.StickyManager(sticky), [sticky]);
|
|
16
|
-
(0, react_1.useEffect)(() => {
|
|
17
|
-
setAdjustedTop(top);
|
|
18
|
-
}, [layoutId, top]);
|
|
19
16
|
const handleSticky = (0, react_1.useCallback)((scroll) => {
|
|
20
17
|
setIsFixed(stickyManager.getIsSticky(scroll));
|
|
21
18
|
setAdjustedTop(stickyManager.getPosition(scroll, top, parentOffsetTop));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntrl-site/sdk-nextjs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "SDK for Next.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/cntrl-site/sdk-nextjs#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@cntrl-site/sdk": "^0.6.
|
|
24
|
+
"@cntrl-site/sdk": "^0.6.3",
|
|
25
25
|
"html-react-parser": "^3.0.1",
|
|
26
26
|
"styled-jsx": "^5.0.2"
|
|
27
27
|
},
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { FC
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { TRichTextItem } from '@cntrl-site/sdk';
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import JSXStyle from 'styled-jsx/style';
|
|
5
5
|
import { ItemProps } from '../Item';
|
|
6
|
-
import { RichTextConverter } from '../../utils/RichTextConverter/RichTextConverter';
|
|
7
|
-
import { useCntrlContext } from '../../provider/useCntrlContext';
|
|
8
6
|
import { useRichTextItem } from './useRichTextItem';
|
|
9
7
|
|
|
10
|
-
const richTextConv = new RichTextConverter();
|
|
11
|
-
|
|
12
8
|
export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item }) => {
|
|
13
9
|
const [content, styles, preset] = useRichTextItem(item);
|
|
14
10
|
const className = preset ? `cntrl-preset-${preset.id}` : undefined;
|
|
@@ -12,10 +12,6 @@ export const useItemSticky = (top: number, parentOffsetTop: number, item: TArtic
|
|
|
12
12
|
const sticky = useMemo(() => item.layoutParams[layoutId].sticky, [layoutId]);
|
|
13
13
|
const stickyManager = useMemo(() => new StickyManager(sticky), [sticky]);
|
|
14
14
|
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
setAdjustedTop(top);
|
|
17
|
-
}, [layoutId, top]);
|
|
18
|
-
|
|
19
15
|
const handleSticky = useCallback((scroll: number) => {
|
|
20
16
|
setIsFixed(stickyManager.getIsSticky(scroll));
|
|
21
17
|
setAdjustedTop(stickyManager.getPosition(
|
|
Binary file
|
|
Binary file
|
|
Binary file
|