@cntrl-site/sdk-nextjs 1.9.71-4 → 1.9.71-6
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.
|
@@ -28,15 +28,17 @@ const StructuredBlockItem = ({ block, maxWidthMap }) => {
|
|
|
28
28
|
const ItemComponent = itemsMap[block.type] || noop;
|
|
29
29
|
return ((0, jsx_runtime_1.jsxs)("div", { className: `structured-block-item-${block.id}`, children: [(0, jsx_runtime_1.jsx)(ItemComponent, { block: block }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
30
30
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hidden, maxWidth]) => {
|
|
31
|
+
var _a, _b;
|
|
31
32
|
const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
|
|
32
33
|
return (`
|
|
33
34
|
.structured-block-item-${block.id} {
|
|
34
35
|
display: ${hidden ? 'none' : 'block'};
|
|
36
|
+
align-self: ${getAlignSelf((_a = area.alignment) !== null && _a !== void 0 ? _a : 'center')};
|
|
35
37
|
width: ${sizingAxis.x === 'manual' && area.width ? `${area.width * 100}vw` : maxWidth !== null && maxWidth !== void 0 ? maxWidth : 'max-content'};
|
|
36
38
|
height: ${sizingAxis.y === 'manual' && area.height ? `${area.height * 100}vw` : 'unset'};
|
|
37
39
|
padding-top: ${area.paddingTop ? `${area.paddingTop * 100}vw` : 'unset'};
|
|
38
|
-
margin: 0 auto;
|
|
39
40
|
outline: none;
|
|
41
|
+
left: ${((_b = area.horizontalOffset) !== null && _b !== void 0 ? _b : 0) * 100}vw;
|
|
40
42
|
position: relative;
|
|
41
43
|
}
|
|
42
44
|
`);
|
|
@@ -44,3 +46,13 @@ const StructuredBlockItem = ({ block, maxWidthMap }) => {
|
|
|
44
46
|
` })] }));
|
|
45
47
|
};
|
|
46
48
|
exports.StructuredBlockItem = StructuredBlockItem;
|
|
49
|
+
function getAlignSelf(alignment) {
|
|
50
|
+
switch (alignment) {
|
|
51
|
+
case 'left':
|
|
52
|
+
return 'start';
|
|
53
|
+
case 'right':
|
|
54
|
+
return 'end';
|
|
55
|
+
default:
|
|
56
|
+
return 'center';
|
|
57
|
+
}
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntrl-site/sdk-nextjs",
|
|
3
|
-
"version": "1.9.71-
|
|
3
|
+
"version": "1.9.71-6",
|
|
4
4
|
"description": "SDK for Next.js",
|
|
5
5
|
"author": "arsen@momdesign.nyc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@antfu/eslint-config": "^3.8.0",
|
|
33
33
|
"@cntrl-site/color": "^1.0.0",
|
|
34
|
-
"@cntrl-site/components": "^1.0.12-alpha.
|
|
34
|
+
"@cntrl-site/components": "^1.0.12-alpha.4",
|
|
35
35
|
"@cntrl-site/effects": "^1.4.2",
|
|
36
|
-
"@cntrl-site/sdk": "1.28.0-
|
|
36
|
+
"@cntrl-site/sdk": "1.28.0-7",
|
|
37
37
|
"@types/vimeo__player": "^2.18.0",
|
|
38
38
|
"@vimeo/player": "^2.25.0",
|
|
39
39
|
"html-react-parser": "^3.0.1",
|
|
@@ -41,11 +41,12 @@ export const StructuredBlockItem: FC<Props> = ({ block, maxWidthMap }) => {
|
|
|
41
41
|
return (`
|
|
42
42
|
.structured-block-item-${block.id} {
|
|
43
43
|
display: ${hidden ? 'none' : 'block'};
|
|
44
|
+
align-self: ${getAlignSelf(area.alignment ?? 'center')};
|
|
44
45
|
width: ${sizingAxis.x === 'manual' && area.width ? `${area.width * 100}vw` : maxWidth ?? 'max-content'};
|
|
45
46
|
height: ${sizingAxis.y === 'manual' && area.height ? `${area.height * 100}vw` : 'unset'};
|
|
46
47
|
padding-top: ${area.paddingTop ? `${area.paddingTop * 100}vw` : 'unset'};
|
|
47
|
-
margin: 0 auto;
|
|
48
48
|
outline: none;
|
|
49
|
+
left: ${(area.horizontalOffset ?? 0) * 100}vw;
|
|
49
50
|
position: relative;
|
|
50
51
|
}
|
|
51
52
|
`);
|
|
@@ -55,3 +56,14 @@ export const StructuredBlockItem: FC<Props> = ({ block, maxWidthMap }) => {
|
|
|
55
56
|
</div>
|
|
56
57
|
);
|
|
57
58
|
};
|
|
59
|
+
|
|
60
|
+
function getAlignSelf(alignment: 'left' | 'center' | 'right') {
|
|
61
|
+
switch (alignment) {
|
|
62
|
+
case 'left':
|
|
63
|
+
return 'start';
|
|
64
|
+
case 'right':
|
|
65
|
+
return 'end';
|
|
66
|
+
default:
|
|
67
|
+
return 'center';
|
|
68
|
+
}
|
|
69
|
+
}
|