@gem-sdk/plugin-cookie-bar 1.0.0 → 1.11.1-staging-ecd90c73
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/CookieBar.js +31 -14
- package/dist/cjs/setting/CookieBar.js +3 -3
- package/dist/cjs/setting/index.js +3 -1
- package/dist/esm/components/CookieBar.js +31 -14
- package/dist/esm/index.js +4 -1
- package/dist/esm/setting/CookieBar.js +3 -3
- package/dist/esm/setting/index.js +3 -1
- package/dist/types/index.d.ts +5 -5
- package/package.json +4 -4
|
@@ -5,20 +5,37 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
|
|
8
|
-
const CookieBar = ({ setting
|
|
9
|
-
const [isVisible, setIsVisible] = react.useState(window.localStorage.getItem('accepted-cookie') !== 'true');
|
|
10
|
-
const acceptCookie = ()
|
|
11
|
-
window.localStorage.setItem('accepted-cookie', 'true');
|
|
12
|
-
setIsVisible(false);
|
|
13
|
-
};
|
|
14
|
-
if (!isVisible)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const CookieBar = ({ setting })=>{
|
|
9
|
+
const [isVisible, setIsVisible] = react.useState(window.localStorage.getItem('accepted-cookie') !== 'true');
|
|
10
|
+
const acceptCookie = ()=>{
|
|
11
|
+
window.localStorage.setItem('accepted-cookie', 'true');
|
|
12
|
+
setIsVisible(false);
|
|
13
|
+
};
|
|
14
|
+
if (!isVisible) return null;
|
|
15
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
16
|
+
className: "fixed inset-x-0 bottom-0 z-90 flex items-center gap-4 bg-white py-6",
|
|
17
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
18
|
+
className: "mx-auto flex items-center gap-4",
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
21
|
+
dangerouslySetInnerHTML: {
|
|
22
|
+
__html: setting?.content ?? ''
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
26
|
+
onClick: acceptCookie,
|
|
27
|
+
"aria-label": "Accept cookie",
|
|
28
|
+
className: "bg-slate-900 px-4 py-2 uppercase text-white",
|
|
29
|
+
children: "Accept cookies"
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
CookieBar.defaultProps = {
|
|
36
|
+
setting: {
|
|
37
|
+
content: `<div><span>This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy.</span></div>`
|
|
38
|
+
}
|
|
22
39
|
};
|
|
23
40
|
|
|
24
41
|
exports.default = CookieBar;
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
|
-
const CookieBar = ({ setting
|
|
5
|
-
const [isVisible, setIsVisible] = useState(window.localStorage.getItem('accepted-cookie') !== 'true');
|
|
6
|
-
const acceptCookie = ()
|
|
7
|
-
window.localStorage.setItem('accepted-cookie', 'true');
|
|
8
|
-
setIsVisible(false);
|
|
9
|
-
};
|
|
10
|
-
if (!isVisible)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const CookieBar = ({ setting })=>{
|
|
5
|
+
const [isVisible, setIsVisible] = useState(window.localStorage.getItem('accepted-cookie') !== 'true');
|
|
6
|
+
const acceptCookie = ()=>{
|
|
7
|
+
window.localStorage.setItem('accepted-cookie', 'true');
|
|
8
|
+
setIsVisible(false);
|
|
9
|
+
};
|
|
10
|
+
if (!isVisible) return null;
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
className: "fixed inset-x-0 bottom-0 z-90 flex items-center gap-4 bg-white py-6",
|
|
13
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
14
|
+
className: "mx-auto flex items-center gap-4",
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsx("div", {
|
|
17
|
+
dangerouslySetInnerHTML: {
|
|
18
|
+
__html: setting?.content ?? ''
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsx("button", {
|
|
22
|
+
onClick: acceptCookie,
|
|
23
|
+
"aria-label": "Accept cookie",
|
|
24
|
+
className: "bg-slate-900 px-4 py-2 uppercase text-white",
|
|
25
|
+
children: "Accept cookies"
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
CookieBar.defaultProps = {
|
|
32
|
+
setting: {
|
|
33
|
+
content: `<div><span>This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy.</span></div>`
|
|
34
|
+
}
|
|
18
35
|
};
|
|
19
36
|
|
|
20
37
|
export { CookieBar as default };
|
package/dist/esm/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as _gem_sdk_core from '@gem-sdk/core';
|
|
2
2
|
import { BaseProps } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
|
-
type CookieBarProps = BaseProps<{
|
|
5
|
-
content?: string;
|
|
6
|
-
}>;
|
|
4
|
+
type CookieBarProps = BaseProps<{
|
|
5
|
+
content?: string;
|
|
6
|
+
}>;
|
|
7
7
|
declare const CookieBar: React.FC<CookieBarProps>;
|
|
8
8
|
|
|
9
|
-
declare const _default: {
|
|
10
|
-
CookieBar: _gem_sdk_core.ComponentSetting<CookieBarProps>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
CookieBar: _gem_sdk_core.ComponentSetting<CookieBarProps>;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export { _default as builderSetting, CookieBar as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/plugin-cookie-bar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1-staging-ecd90c73",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"test": "jest -c ./../../helpers/jest.config.ts"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@gem-sdk/components": "
|
|
23
|
-
"@gem-sdk/core": "
|
|
24
|
-
"@gem-sdk/styles": "
|
|
22
|
+
"@gem-sdk/components": "1.12.0-staging-ecd90c73",
|
|
23
|
+
"@gem-sdk/core": "1.11.1-staging-ecd90c73",
|
|
24
|
+
"@gem-sdk/styles": "1.11.1-staging-ecd90c73"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^17 || ^18",
|