@gem-sdk/pages 1.12.0-next.7 → 1.12.0-prod-e641b7b2
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/dist/cjs/components/Footer.js +45 -39
- package/dist/cjs/components/Header.js +39 -37
- package/dist/cjs/components/ImageToLayout.js +173 -180
- package/dist/esm/components/Footer.js +45 -39
- package/dist/esm/components/Header.js +39 -37
- package/dist/esm/components/ImageToLayout.js +174 -181
- package/package.json +5 -5
|
@@ -6,14 +6,15 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
|
+
const defaultPadding = {
|
|
10
|
+
desktop: '68px',
|
|
11
|
+
tablet: '40px',
|
|
12
|
+
mobile: '40px'
|
|
13
|
+
};
|
|
9
14
|
const Footer = ()=>{
|
|
10
15
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
11
16
|
const [shouldFixed, setShouldFixed] = react.useState(false);
|
|
12
|
-
const [padding, setPadding] = react.useState(
|
|
13
|
-
desktop: '16px',
|
|
14
|
-
tablet: '16px',
|
|
15
|
-
mobile: '16px'
|
|
16
|
-
});
|
|
17
|
+
const [padding, setPadding] = react.useState(defaultPadding);
|
|
17
18
|
react.useEffect(()=>{
|
|
18
19
|
const $iframe = parent.document.querySelector('.iframe');
|
|
19
20
|
if (!$iframe) return;
|
|
@@ -27,6 +28,7 @@ const Footer = ()=>{
|
|
|
27
28
|
const comparedHeight = layoutSetting?.showHeader ? iframeHeight - headerHeight - footerHeight : iframeHeight - footerHeight;
|
|
28
29
|
let prevWidth = 0;
|
|
29
30
|
const observer = new ResizeObserver((entries)=>{
|
|
31
|
+
// Handle resize footer padding according to content
|
|
30
32
|
const currentWidth = entries[0]?.borderBoxSize?.[0]?.inlineSize;
|
|
31
33
|
const shouldUpdatePadding = !!$section.length && typeof currentWidth === 'number' && currentWidth !== prevWidth;
|
|
32
34
|
if (shouldUpdatePadding) {
|
|
@@ -34,12 +36,18 @@ const Footer = ()=>{
|
|
|
34
36
|
const padding = getComputedStyle($section[0]).getPropertyValue('padding-left');
|
|
35
37
|
const margin = getComputedStyle($section[0]).getPropertyValue('margin-left');
|
|
36
38
|
const newPadding = parseInt(margin, 10) + parseInt(padding, 10);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const basePadding = 68;
|
|
40
|
+
if (newPadding > basePadding) {
|
|
41
|
+
setPadding({
|
|
42
|
+
desktop: `${newPadding}px`,
|
|
43
|
+
tablet: `${newPadding}px`,
|
|
44
|
+
mobile: `${newPadding}px`
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
setPadding(defaultPadding);
|
|
48
|
+
}
|
|
42
49
|
}
|
|
50
|
+
// Handle set fixed footer
|
|
43
51
|
const currentEditingFrameHeight = entries[0]?.target.clientHeight;
|
|
44
52
|
if (currentEditingFrameHeight && comparedHeight) setShouldFixed(currentEditingFrameHeight < comparedHeight);
|
|
45
53
|
});
|
|
@@ -47,11 +55,13 @@ const Footer = ()=>{
|
|
|
47
55
|
return ()=>{
|
|
48
56
|
observer.unobserve($storefront);
|
|
49
57
|
};
|
|
50
|
-
}
|
|
58
|
+
}, [
|
|
59
|
+
layoutSetting
|
|
60
|
+
]);
|
|
51
61
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
52
|
-
className: core.cls('gp-footer-container flex h-[48px] items-center justify-between border-y border-
|
|
62
|
+
className: core.cls('gp-footer-container border-1 group flex h-[48px] items-center justify-between border-y border-[#EEEEEE] px-[68px] ', {
|
|
53
63
|
hidden: !layoutSetting?.showFooter,
|
|
54
|
-
'fixed w-full
|
|
64
|
+
'fixed bottom-0 w-full': shouldFixed
|
|
55
65
|
}),
|
|
56
66
|
style: {
|
|
57
67
|
...core.makeStyleResponsive('pl', padding),
|
|
@@ -87,36 +97,32 @@ const Footer = ()=>{
|
|
|
87
97
|
})
|
|
88
98
|
]
|
|
89
99
|
}),
|
|
90
|
-
/*#__PURE__*/ jsxRuntime.
|
|
91
|
-
className: "gp-footer invisible flex h-[
|
|
92
|
-
children:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
viewBox: "0 0 14 14",
|
|
109
|
-
fill: "none",
|
|
110
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
111
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
100
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
101
|
+
className: "gp-footer invisible absolute left-[8px] flex h-[24px] w-[24px] cursor-pointer items-center justify-center rounded bg-[#EEEEEE] p-[4px] hover:bg-[#0000001a] group-hover:visible",
|
|
102
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
103
|
+
className: "flex h-[24px] w-[24px] items-center justify-center",
|
|
104
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
105
|
+
width: "14",
|
|
106
|
+
height: "14",
|
|
107
|
+
viewBox: "0 0 14 14",
|
|
108
|
+
fill: "none",
|
|
109
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
110
|
+
children: [
|
|
111
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
112
|
+
fillRule: "evenodd",
|
|
113
|
+
clipRule: "evenodd",
|
|
114
|
+
d: "M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",
|
|
115
|
+
fill: "#212121"
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
112
118
|
fillRule: "evenodd",
|
|
113
119
|
clipRule: "evenodd",
|
|
114
|
-
d: "
|
|
115
|
-
fill: "#
|
|
120
|
+
d: "M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",
|
|
121
|
+
fill: "#212121"
|
|
116
122
|
})
|
|
117
|
-
|
|
123
|
+
]
|
|
118
124
|
})
|
|
119
|
-
|
|
125
|
+
})
|
|
120
126
|
}),
|
|
121
127
|
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
122
128
|
width: "82",
|
|
@@ -6,13 +6,14 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
|
+
const defaultPadding = {
|
|
10
|
+
desktop: '68px',
|
|
11
|
+
tablet: '40px',
|
|
12
|
+
mobile: '40px'
|
|
13
|
+
};
|
|
9
14
|
const Header = ()=>{
|
|
10
15
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
11
|
-
const [padding, setPadding] = react.useState(
|
|
12
|
-
desktop: '16px',
|
|
13
|
-
tablet: '16px',
|
|
14
|
-
mobile: '16px'
|
|
15
|
-
});
|
|
16
|
+
const [padding, setPadding] = react.useState(defaultPadding);
|
|
16
17
|
react.useEffect(()=>{
|
|
17
18
|
const $iframe = parent.document.querySelector('.iframe');
|
|
18
19
|
if (!$iframe) return;
|
|
@@ -29,11 +30,16 @@ const Header = ()=>{
|
|
|
29
30
|
const padding = getComputedStyle($section[0]).getPropertyValue('padding-left');
|
|
30
31
|
const margin = getComputedStyle($section[0]).getPropertyValue('margin-left');
|
|
31
32
|
const newPadding = parseInt(margin, 10) + parseInt(padding, 10);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const basePadding = 68;
|
|
34
|
+
if (newPadding > basePadding) {
|
|
35
|
+
setPadding({
|
|
36
|
+
desktop: `${newPadding}px`,
|
|
37
|
+
tablet: `${newPadding}px`,
|
|
38
|
+
mobile: `${newPadding}px`
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
setPadding(defaultPadding);
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
});
|
|
39
45
|
observer.observe($storefront);
|
|
@@ -42,7 +48,7 @@ const Header = ()=>{
|
|
|
42
48
|
};
|
|
43
49
|
}, []);
|
|
44
50
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
45
|
-
className: core.cls('gp-header-container flex h-[40px] items-center justify-between border-b border-
|
|
51
|
+
className: core.cls('gp-header-container border-1 group relative flex h-[40px] items-center justify-between border-b border-[#EEEEEE] px-[68px]', {
|
|
46
52
|
hidden: !layoutSetting?.showHeader
|
|
47
53
|
}),
|
|
48
54
|
style: {
|
|
@@ -72,36 +78,32 @@ const Header = ()=>{
|
|
|
72
78
|
})
|
|
73
79
|
]
|
|
74
80
|
}),
|
|
75
|
-
/*#__PURE__*/ jsxRuntime.
|
|
76
|
-
className: "gp-header invisible flex h-[
|
|
77
|
-
children:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
viewBox: "0 0 14 14",
|
|
94
|
-
fill: "none",
|
|
95
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
96
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
81
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
82
|
+
className: "gp-header invisible absolute left-[8px] flex h-[24px] w-[24px] cursor-pointer items-center justify-center rounded bg-[#EEEEEE] p-[4px] hover:bg-[#0000001a] group-hover:visible",
|
|
83
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
84
|
+
className: "flex h-[24px] w-[24px] items-center justify-center",
|
|
85
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
86
|
+
width: "14",
|
|
87
|
+
height: "14",
|
|
88
|
+
viewBox: "0 0 14 14",
|
|
89
|
+
fill: "none",
|
|
90
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
93
|
+
fillRule: "evenodd",
|
|
94
|
+
clipRule: "evenodd",
|
|
95
|
+
d: "M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",
|
|
96
|
+
fill: "#212121"
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
97
99
|
fillRule: "evenodd",
|
|
98
100
|
clipRule: "evenodd",
|
|
99
|
-
d: "
|
|
100
|
-
fill: "#
|
|
101
|
+
d: "M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",
|
|
102
|
+
fill: "#212121"
|
|
101
103
|
})
|
|
102
|
-
|
|
104
|
+
]
|
|
103
105
|
})
|
|
104
|
-
|
|
106
|
+
})
|
|
105
107
|
}),
|
|
106
108
|
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
107
109
|
width: "192",
|