@cntrl-site/sdk-nextjs 0.12.8 → 0.13.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.
- package/lib/components/Item.js +15 -4
- package/lib/components/Section.js +6 -1
- package/lib/components/items/CustomItem.js +18 -1
- package/lib/components/items/ImageItem.js +20 -2
- package/lib/components/items/RectangleItem.js +13 -6
- package/lib/components/items/RichTextItem.js +16 -2
- package/lib/components/items/VideoItem.js +21 -3
- package/lib/components/items/VimeoEmbed.js +48 -15
- package/lib/components/items/YoutubeEmbed.js +15 -1
- package/lib/components/useItemPosition.js +3 -17
- package/lib/components/useSectionColor.js +4 -2
- package/lib/utils/HoverStyles/HoverStyles.js +67 -0
- package/lib/utils/RichTextConverter/RichTextConverter.js +10 -0
- package/lib/utils/getItemTopStyle.js +18 -0
- package/package.json +4 -2
- package/src/components/Item.tsx +15 -5
- package/src/components/Section.tsx +6 -1
- package/src/components/items/CustomItem.tsx +20 -2
- package/src/components/items/ImageItem.tsx +23 -4
- package/src/components/items/RectangleItem.tsx +15 -8
- package/src/components/items/RichTextItem.tsx +18 -4
- package/src/components/items/VideoItem.tsx +30 -11
- package/src/components/items/VimeoEmbed.tsx +62 -29
- package/src/components/items/YoutubeEmbed.tsx +15 -1
- package/src/components/useItemPosition.ts +1 -13
- package/src/components/useSectionColor.ts +7 -3
- package/src/utils/HoverStyles/HoverStyles.ts +74 -0
- package/src/utils/RichTextConverter/RichTextConverter.tsx +10 -0
- package/src/utils/getItemTopStyle.ts +14 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnchorSide } from '@cntrl-site/sdk';
|
|
2
|
+
|
|
3
|
+
export function getItemTopStyle(top: number, anchorSide?: AnchorSide) {
|
|
4
|
+
const defaultValue = `${top * 100}vw`;
|
|
5
|
+
if (!anchorSide) return defaultValue;
|
|
6
|
+
switch (anchorSide) {
|
|
7
|
+
case AnchorSide.Top:
|
|
8
|
+
return defaultValue;
|
|
9
|
+
case AnchorSide.Center:
|
|
10
|
+
return `calc(50% + ${top * 100}vw)`;
|
|
11
|
+
case AnchorSide.Bottom:
|
|
12
|
+
return `calc(100% + ${top * 100}vw)`;
|
|
13
|
+
}
|
|
14
|
+
}
|