@propellerads/cookie-message 3.0.1 → 3.0.2
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/cookie-message.cjs.development.js +1 -1
- package/dist/cookie-message.cjs.development.js.map +1 -1
- package/dist/cookie-message.cjs.production.min.js +1 -1
- package/dist/cookie-message.cjs.production.min.js.map +1 -1
- package/dist/cookie-message.esm.js +2 -2
- package/dist/cookie-message.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/index.tsx +2 -2
|
@@ -52,7 +52,7 @@ var CookieMessage = function CookieMessage(_ref) {
|
|
|
52
52
|
position: position
|
|
53
53
|
}, React__default.createElement(CookieTitle, null, React__default.createElement("b", null, title)), React__default.createElement(CookieInfo, null, children), React__default.createElement(CookieAction, null, React__default.createElement(Button__default, {
|
|
54
54
|
elementId: "cookie-consent",
|
|
55
|
-
type: Button.
|
|
55
|
+
type: Button.ButtonType.Primary,
|
|
56
56
|
onClick: handleClick
|
|
57
57
|
}, "Got it"))) : null;
|
|
58
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-message.cjs.development.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom',\n}\n\nexport interface CookieMessageProps {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: POSITION;\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION;\n}\n\nconst StyledCookieCard = styled.div`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.RIGHT_BOTTOM &&\n css`\n right: ${spacing * 5}px;\n `};\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.LEFT_BOTTOM &&\n css`\n left: ${spacing * 5}px;\n `};\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import React, {useState} from 'react';\nimport Button, {
|
|
1
|
+
{"version":3,"file":"cookie-message.cjs.development.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom',\n}\n\nexport interface CookieMessageProps {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: POSITION;\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION;\n}\n\nconst StyledCookieCard = styled.div`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.RIGHT_BOTTOM &&\n css`\n right: ${spacing * 5}px;\n `};\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.LEFT_BOTTOM &&\n css`\n left: ${spacing * 5}px;\n `};\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import React, {useState} from 'react';\nimport Button, {ButtonType} from '@propellerads/button';\n\nimport {CookieMessageProps, POSITION} from './types';\nimport {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = POSITION.LEFT_BOTTOM,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n return isShow ? (\n <StyledCookieCard position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>{children}</CookieInfo>\n\n <CookieAction>\n <Button elementId=\"cookie-consent\" type={ButtonType.Primary} onClick={handleClick}>\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n ) : null;\n};\n\nexport {CookieMessage};\n"],"names":["POSITION","StyledCookieCard","styled","div","_templateObject","_taggedTemplateLiteralLoose","borderRadius","white","baseShadow","spacing","props","position","RIGHT_BOTTOM","css","_templateObject2","LEFT_BOTTOM","_templateObject3","CookieInfo","_templateObject4","CookieTitle","_templateObject5","CookieAction","_templateObject6","DEFAULT_COOKIE_KEY","CookieMessage","_ref","title","_ref$title","children","_ref$position","_ref$cookieKey","cookieKey","_useState","useState","window","localStorage","getItem","isShow","setShow","handleClick","setItem","React","Button","elementId","type","ButtonType","Primary","onClick"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,IAAYA,QAGX;AAHD,WAAYA,QAAQ;EAClBA,uCAA2B;EAC3BA,yCAA6B;AAC/B,CAAC,EAHWA,QAAQ,KAARA,QAAQ;;;ACFpB,AAQA,IAAMC,gBAAgB,gBAAGC,eAAM,CAACC,GAAG,CAAAC,eAAA,KAAAA,eAAA,gBAAAC,2BAAA,0MAEhBC,2BAAY,EACTC,oBAAK,EACXC,yBAAU,EAGdC,sBAAO,GAAG,CAAC,EACVA,sBAAO,GAAG,CAAC,EAEpB,UAACC,KAA4B;EAAA,OAC7BA,KAAK,CAACC,QAAQ,KAAKX,QAAQ,CAACY,YAAY,IACxCC,UAAG,CAAAC,gBAAA,KAAAA,gBAAA,GAAAT,2BAAA,qCACQI,sBAAO,GAAG,CAAC,CACrB;AAAA,GAED,UAACC,KAA4B;EAAA,OAC7BA,KAAK,CAACC,QAAQ,KAAKX,QAAQ,CAACe,WAAW,IACvCF,UAAG,CAAAG,gBAAA,KAAAA,gBAAA,GAAAX,2BAAA,oCACOI,sBAAO,GAAG,CAAC,CACpB;AAAA,EACJ;AAED,IAAMQ,UAAU,gBAAGf,eAAM,CAACC,GAAG,CAAAe,gBAAA,KAAAA,gBAAA,gBAAAb,2BAAA,qCACVI,sBAAO,GAAG,CAAC,CAC7B;AACD,IAAMU,WAAW,gBAAGjB,eAAM,CAACC,GAAG,CAAAiB,gBAAA,KAAAA,gBAAA,gBAAAf,2BAAA,qCACXI,sBAAO,GAAG,CAAC,CAC7B;AAED,IAAMY,YAAY,gBAAGnB,eAAM,CAACC,GAAG,CAAAmB,gBAAA,KAAAA,gBAAA,gBAAAjB,2BAAA,QAAE;;AChCjC,IAAMkB,kBAAkB,GAAG,sBAAsB;AAEjD,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA;wBACjBC,KAAK;IAALA,KAAK,GAAAC,UAAA,cAAG,SAAS,GAAAA,UAAA;IACjBC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,aAAA,GAAAJ,IAAA,CACRd,QAAQ;IAARA,QAAQ,GAAAkB,aAAA,cAAG7B,QAAQ,CAACe,WAAW,GAAAc,aAAA;IAAAC,cAAA,GAAAL,IAAA,CAC/BM,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAGP,kBAAkB,GAAAO,cAAA;EAE9B,IAAAE,SAAA,GAA0BC,cAAQ,CAAU,CAACC,MAAM,CAACC,YAAY,CAACC,OAAO,CAACL,SAAS,CAAC,CAAC;IAA7EM,MAAM,GAAAL,SAAA;IAAEM,OAAO,GAAAN,SAAA;EAEtB,IAAMO,WAAW,GAAG,SAAdA,WAAWA;IACfL,MAAM,CAACC,YAAY,CAACK,OAAO,CAACT,SAAS,EAAE,MAAM,CAAC;IAC9CO,OAAO,CAAC,KAAK,CAAC;GACf;EAED,OAAOD,MAAM,GACXI,6BAACxC,gBAAgB;IAACU,QAAQ,EAAEA;KAC1B8B,6BAACtB,WAAW,QACVsB,wCAAIf,KAAK,CAAK,CACF,EAEde,6BAACxB,UAAU,QAAEW,QAAQ,CAAc,EAEnCa,6BAACpB,YAAY,QACXoB,6BAACC,eAAM;IAACC,SAAS,EAAC,gBAAgB;IAACC,IAAI,EAAEC,iBAAU,CAACC,OAAO;IAAEC,OAAO,EAAER;cAE7D,CACI,CACE,GACjB,IAAI;AACV,CAAC;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n,t,o,i,r,a,c,l=require("react"),s=e(l),p=require("@propellerads/button"),u=e(p),d=require("styled-components"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n,t,o,i,r,a,c,l=require("react"),s=e(l),p=require("@propellerads/button"),u=e(p),d=require("styled-components"),m=e(d),g=require("@propellerads/stylevariables");function T(e,n){return n||(n=e.slice(0)),e.raw=n,e}!function(e){e.LEFT_BOTTOM="left_bottom",e.RIGHT_BOTTOM="right_bottom"}(n||(n={}));var b=m.div(t||(t=T(["\n width: 320px;\n border-radius: ","px;\n background-color: ",";\n box-shadow: ",";\n position: fixed;\n z-index: 99999;\n bottom: ","px;\n padding: ","px;\n\n ",";\n\n ",";\n"])),g.borderRadius,g.white,g.baseShadow,5*g.spacing,5*g.spacing,(function(e){return e.position===n.RIGHT_BOTTOM&&d.css(o||(o=T(["\n right: ","px;\n "])),5*g.spacing)}),(function(e){return e.position===n.LEFT_BOTTOM&&d.css(i||(i=T(["\n left: ","px;\n "])),5*g.spacing)})),f=m.div(r||(r=T(["\n margin-bottom: ","px;\n"])),3*g.spacing),x=m.div(a||(a=T(["\n margin-bottom: ","px;\n"])),3*g.spacing),v=m.div(c||(c=T([""])));exports.CookieMessage=function(e){var t=e.title,o=void 0===t?"Cookies":t,i=e.children,r=e.position,a=void 0===r?n.LEFT_BOTTOM:r,c=e.cookieKey,d=void 0===c?"accept_cookie_policy":c,m=l.useState(!window.localStorage.getItem(d)),g=m[1];return m[0]?s.createElement(b,{position:a},s.createElement(x,null,s.createElement("b",null,o)),s.createElement(f,null,i),s.createElement(v,null,s.createElement(u,{elementId:"cookie-consent",type:p.ButtonType.Primary,onClick:function(){window.localStorage.setItem(d,"true"),g(!1)}},"Got it"))):null};
|
|
2
2
|
//# sourceMappingURL=cookie-message.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-message.cjs.production.min.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom',\n}\n\nexport interface CookieMessageProps {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: POSITION;\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION;\n}\n\nconst StyledCookieCard = styled.div`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.RIGHT_BOTTOM &&\n css`\n right: ${spacing * 5}px;\n `};\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.LEFT_BOTTOM &&\n css`\n left: ${spacing * 5}px;\n `};\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import React, {useState} from 'react';\nimport Button, {
|
|
1
|
+
{"version":3,"file":"cookie-message.cjs.production.min.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom',\n}\n\nexport interface CookieMessageProps {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: POSITION;\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION;\n}\n\nconst StyledCookieCard = styled.div`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.RIGHT_BOTTOM &&\n css`\n right: ${spacing * 5}px;\n `};\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.LEFT_BOTTOM &&\n css`\n left: ${spacing * 5}px;\n `};\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import React, {useState} from 'react';\nimport Button, {ButtonType} from '@propellerads/button';\n\nimport {CookieMessageProps, POSITION} from './types';\nimport {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = POSITION.LEFT_BOTTOM,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n return isShow ? (\n <StyledCookieCard position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>{children}</CookieInfo>\n\n <CookieAction>\n <Button elementId=\"cookie-consent\" type={ButtonType.Primary} onClick={handleClick}>\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n ) : null;\n};\n\nexport {CookieMessage};\n"],"names":["POSITION","StyledCookieCard","styled","div","_templateObject","_taggedTemplateLiteralLoose","borderRadius","white","baseShadow","spacing","props","position","RIGHT_BOTTOM","css","_templateObject2","LEFT_BOTTOM","_templateObject3","CookieInfo","_templateObject4","CookieTitle","_templateObject5","CookieAction","_templateObject6","_ref","title","_ref$title","children","_ref$position","_ref$cookieKey","cookieKey","_useState","useState","window","localStorage","getItem","setShow","React","Button","elementId","type","ButtonType","Primary","onClick","setItem"],"mappings":"8IAEYA,qNAAZ,SAAYA,GACVA,4BACAA,8BAFF,CAAYA,IAAAA,OCFZ,IAQMC,EAAmBC,EAAOC,IAAGC,IAAAA,EAAAC,mMAEhBC,eACGC,QACNC,aAGM,EAAVC,UACW,EAAVA,WAET,SAACC,GAA4B,OAC7BA,EAAMC,WAAaX,EAASY,cAC5BC,MAAGC,IAAAA,EAAAT,oCACkB,EAAVI,cAGX,SAACC,GAA4B,OAC7BA,EAAMC,WAAaX,EAASe,aAC5BF,MAAGG,IAAAA,EAAAX,mCACiB,EAAVI,cAIRQ,EAAaf,EAAOC,IAAGe,IAAAA,EAAAb,oCACA,EAAVI,WAEbU,EAAcjB,EAAOC,IAAGiB,IAAAA,EAAAf,oCACD,EAAVI,WAGbY,EAAenB,EAAOC,IAAGmB,IAAAA,EAAAjB,gCC9BT,SAAHkB,WACjBC,MAAAA,WAAKC,EAAG,UAASA,EACjBC,EAAQH,EAARG,SAAQC,EAAAJ,EACRZ,SAAAA,WAAQgB,EAAG3B,EAASe,YAAWY,EAAAC,EAAAL,EAC/BM,UAAAA,WAASD,EANgB,uBAMKA,EAE9BE,EAA0BC,YAAmBC,OAAOC,aAAaC,QAAQL,IAA1DM,EAAOL,KAOtB,OAPaA,KAQXM,gBAACnC,GAAiBU,SAAUA,GAC1ByB,gBAACjB,OACCiB,yBAAIZ,IAGNY,gBAACnB,OAAYS,GAEbU,gBAACf,OACCe,gBAACC,GAAOC,UAAU,iBAAiBC,KAAMC,aAAWC,QAASC,QAd/C,WAClBV,OAAOC,aAAaU,QAAQd,EAAW,QACvCM,GAAQ,iBAiBN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import Button, {
|
|
2
|
+
import Button, { ButtonType } from '@propellerads/button';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { borderRadius, white, baseShadow, spacing } from '@propellerads/stylevariables';
|
|
5
5
|
|
|
@@ -43,7 +43,7 @@ var CookieMessage = function CookieMessage(_ref) {
|
|
|
43
43
|
position: position
|
|
44
44
|
}, React.createElement(CookieTitle, null, React.createElement("b", null, title)), React.createElement(CookieInfo, null, children), React.createElement(CookieAction, null, React.createElement(Button, {
|
|
45
45
|
elementId: "cookie-consent",
|
|
46
|
-
type:
|
|
46
|
+
type: ButtonType.Primary,
|
|
47
47
|
onClick: handleClick
|
|
48
48
|
}, "Got it"))) : null;
|
|
49
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-message.esm.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom',\n}\n\nexport interface CookieMessageProps {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: POSITION;\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION;\n}\n\nconst StyledCookieCard = styled.div`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.RIGHT_BOTTOM &&\n css`\n right: ${spacing * 5}px;\n `};\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.LEFT_BOTTOM &&\n css`\n left: ${spacing * 5}px;\n `};\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import React, {useState} from 'react';\nimport Button, {
|
|
1
|
+
{"version":3,"file":"cookie-message.esm.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React, {ReactNode} from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom',\n}\n\nexport interface CookieMessageProps {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: POSITION;\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION;\n}\n\nconst StyledCookieCard = styled.div`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.RIGHT_BOTTOM &&\n css`\n right: ${spacing * 5}px;\n `};\n\n ${(props: StyledCookieCardProps) =>\n props.position === POSITION.LEFT_BOTTOM &&\n css`\n left: ${spacing * 5}px;\n `};\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import React, {useState} from 'react';\nimport Button, {ButtonType} from '@propellerads/button';\n\nimport {CookieMessageProps, POSITION} from './types';\nimport {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = POSITION.LEFT_BOTTOM,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n return isShow ? (\n <StyledCookieCard position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>{children}</CookieInfo>\n\n <CookieAction>\n <Button elementId=\"cookie-consent\" type={ButtonType.Primary} onClick={handleClick}>\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n ) : null;\n};\n\nexport {CookieMessage};\n"],"names":["POSITION","StyledCookieCard","styled","div","_templateObject","_taggedTemplateLiteralLoose","borderRadius","white","baseShadow","spacing","props","position","RIGHT_BOTTOM","css","_templateObject2","LEFT_BOTTOM","_templateObject3","CookieInfo","_templateObject4","CookieTitle","_templateObject5","CookieAction","_templateObject6","DEFAULT_COOKIE_KEY","CookieMessage","_ref","title","_ref$title","children","_ref$position","_ref$cookieKey","cookieKey","_useState","useState","window","localStorage","getItem","isShow","setShow","handleClick","setItem","React","Button","elementId","type","ButtonType","Primary","onClick"],"mappings":";;;;;;;;;AAEA,IAAYA,QAGX;AAHD,WAAYA,QAAQ;EAClBA,uCAA2B;EAC3BA,yCAA6B;AAC/B,CAAC,EAHWA,QAAQ,KAARA,QAAQ;;;ACFpB,AAQA,IAAMC,gBAAgB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,eAAA,KAAAA,eAAA,gBAAAC,2BAAA,0MAEhBC,YAAY,EACTC,KAAK,EACXC,UAAU,EAGdC,OAAO,GAAG,CAAC,EACVA,OAAO,GAAG,CAAC,EAEpB,UAACC,KAA4B;EAAA,OAC7BA,KAAK,CAACC,QAAQ,KAAKX,QAAQ,CAACY,YAAY,IACxCC,GAAG,CAAAC,gBAAA,KAAAA,gBAAA,GAAAT,2BAAA,qCACQI,OAAO,GAAG,CAAC,CACrB;AAAA,GAED,UAACC,KAA4B;EAAA,OAC7BA,KAAK,CAACC,QAAQ,KAAKX,QAAQ,CAACe,WAAW,IACvCF,GAAG,CAAAG,gBAAA,KAAAA,gBAAA,GAAAX,2BAAA,oCACOI,OAAO,GAAG,CAAC,CACpB;AAAA,EACJ;AAED,IAAMQ,UAAU,gBAAGf,MAAM,CAACC,GAAG,CAAAe,gBAAA,KAAAA,gBAAA,gBAAAb,2BAAA,qCACVI,OAAO,GAAG,CAAC,CAC7B;AACD,IAAMU,WAAW,gBAAGjB,MAAM,CAACC,GAAG,CAAAiB,gBAAA,KAAAA,gBAAA,gBAAAf,2BAAA,qCACXI,OAAO,GAAG,CAAC,CAC7B;AAED,IAAMY,YAAY,gBAAGnB,MAAM,CAACC,GAAG,CAAAmB,gBAAA,KAAAA,gBAAA,gBAAAjB,2BAAA,QAAE;;AChCjC,IAAMkB,kBAAkB,GAAG,sBAAsB;AAEjD,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA;wBACjBC,KAAK;IAALA,KAAK,GAAAC,UAAA,cAAG,SAAS,GAAAA,UAAA;IACjBC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,aAAA,GAAAJ,IAAA,CACRd,QAAQ;IAARA,QAAQ,GAAAkB,aAAA,cAAG7B,QAAQ,CAACe,WAAW,GAAAc,aAAA;IAAAC,cAAA,GAAAL,IAAA,CAC/BM,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAGP,kBAAkB,GAAAO,cAAA;EAE9B,IAAAE,SAAA,GAA0BC,QAAQ,CAAU,CAACC,MAAM,CAACC,YAAY,CAACC,OAAO,CAACL,SAAS,CAAC,CAAC;IAA7EM,MAAM,GAAAL,SAAA;IAAEM,OAAO,GAAAN,SAAA;EAEtB,IAAMO,WAAW,GAAG,SAAdA,WAAWA;IACfL,MAAM,CAACC,YAAY,CAACK,OAAO,CAACT,SAAS,EAAE,MAAM,CAAC;IAC9CO,OAAO,CAAC,KAAK,CAAC;GACf;EAED,OAAOD,MAAM,GACXI,oBAACxC,gBAAgB;IAACU,QAAQ,EAAEA;KAC1B8B,oBAACtB,WAAW,QACVsB,+BAAIf,KAAK,CAAK,CACF,EAEde,oBAACxB,UAAU,QAAEW,QAAQ,CAAc,EAEnCa,oBAACpB,YAAY,QACXoB,oBAACC,MAAM;IAACC,SAAS,EAAC,gBAAgB;IAACC,IAAI,EAAEC,UAAU,CAACC,OAAO;IAAEC,OAAO,EAAER;cAE7D,CACI,CACE,GACjB,IAAI;AACV,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/cookie-message",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"repository": "https://github.com/propellerads/ui-components",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/react": "18.3.24"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@propellerads/button": "^
|
|
35
|
-
"@propellerads/stylevariables": "^2.0.
|
|
34
|
+
"@propellerads/button": "^9.0.0",
|
|
35
|
+
"@propellerads/stylevariables": "^2.0.2"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, {useState} from 'react';
|
|
2
|
-
import Button, {
|
|
2
|
+
import Button, {ButtonType} from '@propellerads/button';
|
|
3
3
|
|
|
4
4
|
import {CookieMessageProps, POSITION} from './types';
|
|
5
5
|
import {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';
|
|
@@ -28,7 +28,7 @@ const CookieMessage = ({
|
|
|
28
28
|
<CookieInfo>{children}</CookieInfo>
|
|
29
29
|
|
|
30
30
|
<CookieAction>
|
|
31
|
-
<Button elementId="cookie-consent" type={
|
|
31
|
+
<Button elementId="cookie-consent" type={ButtonType.Primary} onClick={handleClick}>
|
|
32
32
|
Got it
|
|
33
33
|
</Button>
|
|
34
34
|
</CookieAction>
|