@gem-sdk/components 2.0.0-dev.471 → 2.0.0-dev.473
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/sticky/components/Sticky.js +17 -7
- package/dist/cjs/sticky/components/Sticky.liquid.js +14 -3
- package/dist/cjs/sticky/components/common/classes.js +11 -0
- package/dist/cjs/sticky/components/common/styles.js +19 -18
- package/dist/cjs/sticky/components/hooks/useSticky.js +5 -2
- package/dist/esm/sticky/components/Sticky.js +20 -10
- package/dist/esm/sticky/components/Sticky.liquid.js +17 -6
- package/dist/esm/sticky/components/common/classes.js +9 -0
- package/dist/esm/sticky/components/common/styles.js +20 -20
- package/dist/esm/sticky/components/hooks/useSticky.js +5 -2
- package/package.json +1 -1
|
@@ -12,19 +12,30 @@ var _const = require('../../common/const.js');
|
|
|
12
12
|
var useSticky = require('./hooks/useSticky.js');
|
|
13
13
|
var system = require('@gem-sdk/system');
|
|
14
14
|
var styles = require('./common/styles.js');
|
|
15
|
+
var classes = require('./common/classes.js');
|
|
15
16
|
|
|
16
|
-
const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
17
|
-
const { background, preloadBgImage } = setting ?? {};
|
|
18
|
-
const { w, positionStyle, displayStyle
|
|
17
|
+
const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
|
|
18
|
+
const { background, preloadBgImage, width, isScrollToTop } = setting ?? {};
|
|
19
|
+
const { w, positionStyle, displayStyle } = useSticky.default(setting);
|
|
19
20
|
const computedContainerStyles = system.createStyle({
|
|
20
21
|
margin: '0 auto',
|
|
21
22
|
...w,
|
|
22
23
|
...displayStyle,
|
|
23
24
|
...styles.getStylePadding(style),
|
|
24
25
|
...positionStyle,
|
|
25
|
-
...getCSSAlign,
|
|
26
26
|
zIndex: _const.ELEMENT_Z_INDEX.STICKY
|
|
27
27
|
});
|
|
28
|
+
const computedContentStyles = system.createStyle(styles.getContentStyles({
|
|
29
|
+
width,
|
|
30
|
+
style,
|
|
31
|
+
background
|
|
32
|
+
}));
|
|
33
|
+
const computedContainerClasses = system.createClass(classes.getContainerClasses({
|
|
34
|
+
uid: builderProps?.uid,
|
|
35
|
+
isScrollToTop,
|
|
36
|
+
cssClass: advanced?.cssClass,
|
|
37
|
+
isLiquid: false
|
|
38
|
+
}));
|
|
28
39
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29
40
|
children: [
|
|
30
41
|
!!preloadBgImage && /*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
@@ -47,15 +58,14 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
|
47
58
|
]
|
|
48
59
|
}),
|
|
49
60
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
50
|
-
className:
|
|
61
|
+
className: computedContainerClasses,
|
|
51
62
|
id: builderProps?.uid,
|
|
52
63
|
style: computedContainerStyles,
|
|
53
64
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
54
65
|
...builderAttrs,
|
|
55
66
|
"data-id": builderProps?.uid,
|
|
56
67
|
style: {
|
|
57
|
-
...
|
|
58
|
-
...core.getStyleBackgroundByDevice(background)
|
|
68
|
+
...computedContentStyles
|
|
59
69
|
},
|
|
60
70
|
children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : children
|
|
61
71
|
})
|
|
@@ -6,6 +6,7 @@ var core = require('@gem-sdk/core');
|
|
|
6
6
|
var helpers = require('../../helpers.js');
|
|
7
7
|
var system = require('@gem-sdk/system');
|
|
8
8
|
var styles = require('./common/styles.js');
|
|
9
|
+
var classes = require('./common/classes.js');
|
|
9
10
|
|
|
10
11
|
const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
|
|
11
12
|
const { width, position, display, preloadBgImage, background, isScrollToTop } = setting ?? {};
|
|
@@ -16,6 +17,17 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
16
17
|
style,
|
|
17
18
|
display
|
|
18
19
|
}));
|
|
20
|
+
const computedContentStyles = system.createStyle(styles.getContentStyles({
|
|
21
|
+
width,
|
|
22
|
+
style,
|
|
23
|
+
background
|
|
24
|
+
}));
|
|
25
|
+
const computedContainerClasses = system.createClass(classes.getContainerClasses({
|
|
26
|
+
uid: builderProps?.uid,
|
|
27
|
+
isScrollToTop,
|
|
28
|
+
cssClass: advanced?.cssClass,
|
|
29
|
+
isLiquid: true
|
|
30
|
+
}));
|
|
19
31
|
const createDataState = system.createStateOrContext({
|
|
20
32
|
uid: builderProps?.uid,
|
|
21
33
|
setting: {
|
|
@@ -32,14 +44,13 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
32
44
|
gp-data='${JSON.stringify(createDataState)}'
|
|
33
45
|
id="${builderProps?.uid}"
|
|
34
46
|
data-id="${builderProps?.uid}"
|
|
35
|
-
class="${
|
|
47
|
+
class="${computedContainerClasses} ${helpers.getSettingPreloadData('gps-lazy')}"
|
|
36
48
|
style="${computedContainerStyles}"
|
|
37
49
|
>
|
|
38
50
|
<div ${{
|
|
39
51
|
...builderAttrs
|
|
40
52
|
}} style="${{
|
|
41
|
-
...
|
|
42
|
-
...core.getStyleBackgroundByDevice(background)
|
|
53
|
+
...computedContentStyles
|
|
43
54
|
}}">
|
|
44
55
|
${children}
|
|
45
56
|
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getContainerClasses = (args)=>{
|
|
6
|
+
const { uid, isScrollToTop, cssClass, isLiquid } = args;
|
|
7
|
+
const extraClass = isScrollToTop && isLiquid ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : '';
|
|
8
|
+
return core.composeClasses(`sticky-wrapper gp-w-full ${extraClass} ${uid} ${cssClass}`);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.getContainerClasses = getContainerClasses;
|
|
@@ -5,29 +5,19 @@ require('react/jsx-runtime');
|
|
|
5
5
|
require('react');
|
|
6
6
|
var _const = require('../../../common/const.js');
|
|
7
7
|
|
|
8
|
-
const getCSSAlignByDevice = (position, device)=>{
|
|
9
|
-
return {
|
|
10
|
-
[`--left${device}`]: position == 'top' ? '0' : '50%',
|
|
11
|
-
[`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
const getCSSAlign = (position)=>{
|
|
15
|
-
return {
|
|
16
|
-
...getCSSAlignByDevice(position?.desktop, ''),
|
|
17
|
-
...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
|
|
18
|
-
...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
8
|
const getDisplayStyle = (device, display, position)=>{
|
|
22
9
|
const style = {
|
|
23
10
|
[`--top${device}`]: 'auto',
|
|
24
11
|
[`--${position + device}`]: '0',
|
|
25
|
-
[`--pos${device}`]: getCSSPosition(position)
|
|
12
|
+
[`--pos${device}`]: getCSSPosition(position, device)
|
|
26
13
|
};
|
|
27
14
|
if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
|
|
28
15
|
return style;
|
|
29
16
|
};
|
|
30
|
-
const getCSSPosition = (position)=>{
|
|
17
|
+
const getCSSPosition = (position, device)=>{
|
|
18
|
+
if (device === '-mobile') {
|
|
19
|
+
return 'fixed';
|
|
20
|
+
}
|
|
31
21
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
32
22
|
};
|
|
33
23
|
const displayConditionStyle = (display, position)=>{
|
|
@@ -38,16 +28,26 @@ const displayConditionStyle = (display, position)=>{
|
|
|
38
28
|
};
|
|
39
29
|
};
|
|
40
30
|
const getContainerStyles = (args)=>{
|
|
41
|
-
const { style,
|
|
31
|
+
const { style, position, display } = args;
|
|
42
32
|
return {
|
|
43
33
|
margin: '0 auto',
|
|
44
34
|
...getStylePadding(style),
|
|
45
|
-
...core.makeStyleResponsive('w', width),
|
|
46
35
|
...displayConditionStyle(display, position),
|
|
47
|
-
...getCSSAlign(position),
|
|
48
36
|
'z-index': _const.ELEMENT_Z_INDEX.STICKY
|
|
49
37
|
};
|
|
50
38
|
};
|
|
39
|
+
const getContentStyles = (args)=>{
|
|
40
|
+
const { style, width, background } = args;
|
|
41
|
+
return {
|
|
42
|
+
...core.makeStyle({
|
|
43
|
+
m: '0 auto'
|
|
44
|
+
}),
|
|
45
|
+
...core.makeStyleResponsive('w', width),
|
|
46
|
+
...filterStyles(style),
|
|
47
|
+
...core.getGradientBgrStyleByDevice(background),
|
|
48
|
+
...core.getStyleBackgroundByDevice(background)
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
51
|
const getStylePadding = (style)=>{
|
|
52
52
|
const keepList = [
|
|
53
53
|
'--pt',
|
|
@@ -98,5 +98,6 @@ const filterStyles = (style)=>{
|
|
|
98
98
|
exports.displayConditionStyle = displayConditionStyle;
|
|
99
99
|
exports.filterStyles = filterStyles;
|
|
100
100
|
exports.getContainerStyles = getContainerStyles;
|
|
101
|
+
exports.getContentStyles = getContentStyles;
|
|
101
102
|
exports.getDisplayStyle = getDisplayStyle;
|
|
102
103
|
exports.getStylePadding = getStylePadding;
|
|
@@ -10,7 +10,10 @@ const useSticky = (setting)=>{
|
|
|
10
10
|
const w = core.makeStyleResponsive('w', width);
|
|
11
11
|
const sidebarMode = core.usePageStore((s)=>s.sidebarMode === 'interaction');
|
|
12
12
|
const currentDevice = core.useCurrentDevice();
|
|
13
|
-
const getCSSPosition = (position)=>{
|
|
13
|
+
const getCSSPosition = (position, isMobile)=>{
|
|
14
|
+
if (isMobile) {
|
|
15
|
+
return 'fixed';
|
|
16
|
+
}
|
|
14
17
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
15
18
|
};
|
|
16
19
|
const getCSSAlignByDevice = (position, device)=>{
|
|
@@ -59,7 +62,7 @@ const useSticky = (setting)=>{
|
|
|
59
62
|
return {
|
|
60
63
|
[`--pos`]: getCSSPosition(position?.desktop),
|
|
61
64
|
[`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
|
|
62
|
-
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
|
|
65
|
+
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop, true)
|
|
63
66
|
};
|
|
64
67
|
}, [
|
|
65
68
|
position?.desktop,
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { isEmptyChildren } from '@gem-sdk/core';
|
|
4
4
|
import Head from 'next/head';
|
|
5
5
|
import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import { ELEMENT_Z_INDEX } from '../../common/const.js';
|
|
8
8
|
import useSticky from './hooks/useSticky.js';
|
|
9
|
-
import { createStyle } from '@gem-sdk/system';
|
|
10
|
-
import { getStylePadding,
|
|
9
|
+
import { createStyle, createClass } from '@gem-sdk/system';
|
|
10
|
+
import { getStylePadding, getContentStyles } from './common/styles.js';
|
|
11
|
+
import { getContainerClasses } from './common/classes.js';
|
|
11
12
|
|
|
12
|
-
const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
13
|
-
const { background, preloadBgImage } = setting ?? {};
|
|
14
|
-
const { w, positionStyle, displayStyle
|
|
13
|
+
const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
|
|
14
|
+
const { background, preloadBgImage, width, isScrollToTop } = setting ?? {};
|
|
15
|
+
const { w, positionStyle, displayStyle } = useSticky(setting);
|
|
15
16
|
const computedContainerStyles = createStyle({
|
|
16
17
|
margin: '0 auto',
|
|
17
18
|
...w,
|
|
18
19
|
...displayStyle,
|
|
19
20
|
...getStylePadding(style),
|
|
20
21
|
...positionStyle,
|
|
21
|
-
...getCSSAlign,
|
|
22
22
|
zIndex: ELEMENT_Z_INDEX.STICKY
|
|
23
23
|
});
|
|
24
|
+
const computedContentStyles = createStyle(getContentStyles({
|
|
25
|
+
width,
|
|
26
|
+
style,
|
|
27
|
+
background
|
|
28
|
+
}));
|
|
29
|
+
const computedContainerClasses = createClass(getContainerClasses({
|
|
30
|
+
uid: builderProps?.uid,
|
|
31
|
+
isScrollToTop,
|
|
32
|
+
cssClass: advanced?.cssClass,
|
|
33
|
+
isLiquid: false
|
|
34
|
+
}));
|
|
24
35
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
25
36
|
children: [
|
|
26
37
|
!!preloadBgImage && /*#__PURE__*/ jsxs(Head, {
|
|
@@ -43,15 +54,14 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
|
43
54
|
]
|
|
44
55
|
}),
|
|
45
56
|
/*#__PURE__*/ jsx("div", {
|
|
46
|
-
className:
|
|
57
|
+
className: computedContainerClasses,
|
|
47
58
|
id: builderProps?.uid,
|
|
48
59
|
style: computedContainerStyles,
|
|
49
60
|
children: /*#__PURE__*/ jsx("div", {
|
|
50
61
|
...builderAttrs,
|
|
51
62
|
"data-id": builderProps?.uid,
|
|
52
63
|
style: {
|
|
53
|
-
...
|
|
54
|
-
...getStyleBackgroundByDevice(background)
|
|
64
|
+
...computedContentStyles
|
|
55
65
|
},
|
|
56
66
|
children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
|
|
57
67
|
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { template, RenderIf,
|
|
1
|
+
import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import { getSettingPreloadData } from '../../helpers.js';
|
|
3
|
-
import { createStyle, createStateOrContext } from '@gem-sdk/system';
|
|
4
|
-
import { getContainerStyles,
|
|
3
|
+
import { createStyle, createClass, createStateOrContext } from '@gem-sdk/system';
|
|
4
|
+
import { getContainerStyles, getContentStyles } from './common/styles.js';
|
|
5
|
+
import { getContainerClasses } from './common/classes.js';
|
|
5
6
|
|
|
6
7
|
const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
|
|
7
8
|
const { width, position, display, preloadBgImage, background, isScrollToTop } = setting ?? {};
|
|
@@ -12,6 +13,17 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
12
13
|
style,
|
|
13
14
|
display
|
|
14
15
|
}));
|
|
16
|
+
const computedContentStyles = createStyle(getContentStyles({
|
|
17
|
+
width,
|
|
18
|
+
style,
|
|
19
|
+
background
|
|
20
|
+
}));
|
|
21
|
+
const computedContainerClasses = createClass(getContainerClasses({
|
|
22
|
+
uid: builderProps?.uid,
|
|
23
|
+
isScrollToTop,
|
|
24
|
+
cssClass: advanced?.cssClass,
|
|
25
|
+
isLiquid: true
|
|
26
|
+
}));
|
|
15
27
|
const createDataState = createStateOrContext({
|
|
16
28
|
uid: builderProps?.uid,
|
|
17
29
|
setting: {
|
|
@@ -28,14 +40,13 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
28
40
|
gp-data='${JSON.stringify(createDataState)}'
|
|
29
41
|
id="${builderProps?.uid}"
|
|
30
42
|
data-id="${builderProps?.uid}"
|
|
31
|
-
class="${
|
|
43
|
+
class="${computedContainerClasses} ${getSettingPreloadData('gps-lazy')}"
|
|
32
44
|
style="${computedContainerStyles}"
|
|
33
45
|
>
|
|
34
46
|
<div ${{
|
|
35
47
|
...builderAttrs
|
|
36
48
|
}} style="${{
|
|
37
|
-
...
|
|
38
|
-
...getStyleBackgroundByDevice(background)
|
|
49
|
+
...computedContentStyles
|
|
39
50
|
}}">
|
|
40
51
|
${children}
|
|
41
52
|
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { composeClasses } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
const getContainerClasses = (args)=>{
|
|
4
|
+
const { uid, isScrollToTop, cssClass, isLiquid } = args;
|
|
5
|
+
const extraClass = isScrollToTop && isLiquid ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : '';
|
|
6
|
+
return composeClasses(`sticky-wrapper gp-w-full ${extraClass} ${uid} ${cssClass}`);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { getContainerClasses };
|
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
import { makeStyleResponsive } from '@gem-sdk/core';
|
|
1
|
+
import { makeStyle, makeStyleResponsive, getGradientBgrStyleByDevice, getStyleBackgroundByDevice } from '@gem-sdk/core';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
4
|
import { ELEMENT_Z_INDEX } from '../../../common/const.js';
|
|
5
5
|
|
|
6
|
-
const getCSSAlignByDevice = (position, device)=>{
|
|
7
|
-
return {
|
|
8
|
-
[`--left${device}`]: position == 'top' ? '0' : '50%',
|
|
9
|
-
[`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
const getCSSAlign = (position)=>{
|
|
13
|
-
return {
|
|
14
|
-
...getCSSAlignByDevice(position?.desktop, ''),
|
|
15
|
-
...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
|
|
16
|
-
...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
6
|
const getDisplayStyle = (device, display, position)=>{
|
|
20
7
|
const style = {
|
|
21
8
|
[`--top${device}`]: 'auto',
|
|
22
9
|
[`--${position + device}`]: '0',
|
|
23
|
-
[`--pos${device}`]: getCSSPosition(position)
|
|
10
|
+
[`--pos${device}`]: getCSSPosition(position, device)
|
|
24
11
|
};
|
|
25
12
|
if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
|
|
26
13
|
return style;
|
|
27
14
|
};
|
|
28
|
-
const getCSSPosition = (position)=>{
|
|
15
|
+
const getCSSPosition = (position, device)=>{
|
|
16
|
+
if (device === '-mobile') {
|
|
17
|
+
return 'fixed';
|
|
18
|
+
}
|
|
29
19
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
30
20
|
};
|
|
31
21
|
const displayConditionStyle = (display, position)=>{
|
|
@@ -36,16 +26,26 @@ const displayConditionStyle = (display, position)=>{
|
|
|
36
26
|
};
|
|
37
27
|
};
|
|
38
28
|
const getContainerStyles = (args)=>{
|
|
39
|
-
const { style,
|
|
29
|
+
const { style, position, display } = args;
|
|
40
30
|
return {
|
|
41
31
|
margin: '0 auto',
|
|
42
32
|
...getStylePadding(style),
|
|
43
|
-
...makeStyleResponsive('w', width),
|
|
44
33
|
...displayConditionStyle(display, position),
|
|
45
|
-
...getCSSAlign(position),
|
|
46
34
|
'z-index': ELEMENT_Z_INDEX.STICKY
|
|
47
35
|
};
|
|
48
36
|
};
|
|
37
|
+
const getContentStyles = (args)=>{
|
|
38
|
+
const { style, width, background } = args;
|
|
39
|
+
return {
|
|
40
|
+
...makeStyle({
|
|
41
|
+
m: '0 auto'
|
|
42
|
+
}),
|
|
43
|
+
...makeStyleResponsive('w', width),
|
|
44
|
+
...filterStyles(style),
|
|
45
|
+
...getGradientBgrStyleByDevice(background),
|
|
46
|
+
...getStyleBackgroundByDevice(background)
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
49
|
const getStylePadding = (style)=>{
|
|
50
50
|
const keepList = [
|
|
51
51
|
'--pt',
|
|
@@ -93,4 +93,4 @@ const filterStyles = (style)=>{
|
|
|
93
93
|
return cloneStyle;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
export { displayConditionStyle, filterStyles, getContainerStyles, getDisplayStyle, getStylePadding };
|
|
96
|
+
export { displayConditionStyle, filterStyles, getContainerStyles, getContentStyles, getDisplayStyle, getStylePadding };
|
|
@@ -6,7 +6,10 @@ const useSticky = (setting)=>{
|
|
|
6
6
|
const w = makeStyleResponsive('w', width);
|
|
7
7
|
const sidebarMode = usePageStore((s)=>s.sidebarMode === 'interaction');
|
|
8
8
|
const currentDevice = useCurrentDevice();
|
|
9
|
-
const getCSSPosition = (position)=>{
|
|
9
|
+
const getCSSPosition = (position, isMobile)=>{
|
|
10
|
+
if (isMobile) {
|
|
11
|
+
return 'fixed';
|
|
12
|
+
}
|
|
10
13
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
11
14
|
};
|
|
12
15
|
const getCSSAlignByDevice = (position, device)=>{
|
|
@@ -55,7 +58,7 @@ const useSticky = (setting)=>{
|
|
|
55
58
|
return {
|
|
56
59
|
[`--pos`]: getCSSPosition(position?.desktop),
|
|
57
60
|
[`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
|
|
58
|
-
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
|
|
61
|
+
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop, true)
|
|
59
62
|
};
|
|
60
63
|
}, [
|
|
61
64
|
position?.desktop,
|