@cntrl-site/sdk-nextjs 0.16.3 → 0.16.4
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
|
package/lib/components/Item.js
CHANGED
|
@@ -80,7 +80,12 @@ const Item = ({ item, sectionId, articleHeight }) => {
|
|
|
80
80
|
setWrapperHeight(undefined);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const itemArticleOffset = (sectionTop + itemSectionTop) / window.innerWidth;
|
|
84
|
+
const maxStickyTo = articleHeight - itemArticleOffset - height;
|
|
85
|
+
const end = sticky.to
|
|
86
|
+
? Math.min(maxStickyTo, sticky.to)
|
|
87
|
+
: articleHeight - itemArticleOffset - height;
|
|
88
|
+
const wrapperHeight = end - sticky.from + height;
|
|
84
89
|
setItemHeight(height);
|
|
85
90
|
setWrapperHeight(wrapperHeight);
|
|
86
91
|
};
|
|
@@ -142,11 +147,6 @@ const Item = ({ item, sectionId, articleHeight }) => {
|
|
|
142
147
|
` }))] })));
|
|
143
148
|
};
|
|
144
149
|
exports.Item = Item;
|
|
145
|
-
function getStickyItemWrapperHeight(sticky, itemHeight, articleHeight, itemArticleOffset) {
|
|
146
|
-
var _a;
|
|
147
|
-
const end = (_a = sticky.to) !== null && _a !== void 0 ? _a : articleHeight - itemArticleOffset - itemHeight;
|
|
148
|
-
return end - sticky.from + itemHeight;
|
|
149
|
-
}
|
|
150
150
|
function parseSizing(sizing = 'manual') {
|
|
151
151
|
const axisSizing = sizing.split(' ');
|
|
152
152
|
return {
|
package/package.json
CHANGED
package/src/components/Item.tsx
CHANGED
|
@@ -101,7 +101,12 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight }) =
|
|
|
101
101
|
setWrapperHeight(undefined);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const itemArticleOffset = (sectionTop + itemSectionTop) / window.innerWidth;
|
|
105
|
+
const maxStickyTo = articleHeight - itemArticleOffset - height;
|
|
106
|
+
const end = sticky.to
|
|
107
|
+
? Math.min(maxStickyTo, sticky.to)
|
|
108
|
+
: articleHeight - itemArticleOffset - height;
|
|
109
|
+
const wrapperHeight = end - sticky.from + height;
|
|
105
110
|
setItemHeight(height);
|
|
106
111
|
setWrapperHeight(wrapperHeight);
|
|
107
112
|
};
|
|
@@ -189,16 +194,6 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight }) =
|
|
|
189
194
|
);
|
|
190
195
|
};
|
|
191
196
|
|
|
192
|
-
function getStickyItemWrapperHeight(
|
|
193
|
-
sticky: TStickyParams,
|
|
194
|
-
itemHeight: number,
|
|
195
|
-
articleHeight: number,
|
|
196
|
-
itemArticleOffset: number,
|
|
197
|
-
) {
|
|
198
|
-
const end = sticky.to ?? articleHeight - itemArticleOffset - itemHeight;
|
|
199
|
-
return end - sticky.from + itemHeight;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
197
|
function parseSizing(sizing: string = 'manual'): Axis {
|
|
203
198
|
const axisSizing = sizing.split(' ');
|
|
204
199
|
return {
|