@esm/cookie-consent-banner
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,20 +5,47 @@ 'use strict'; | ||
/* | ||
* | ||
* 🐹 Oh hi there! Welcome to your brand new pika package! | ||
* | ||
* If this is your first time, take a second to familiarize yourself with the editor. | ||
* Then, whenever you're ready, delete all of this and start writing! | ||
* | ||
* We can't wait to see what you build! | ||
* | ||
* Yours, | ||
* The Pika Team | ||
*/ | ||
// PS: Here's a dumb placeholder function to help you get started: | ||
function main() { | ||
return `<div>Cookie consent banner here.</div>`; | ||
function build(position) { | ||
let modalCss = ''; | ||
let innerCss = ''; | ||
if (position === 'modal') { | ||
// open the banner as modal | ||
modalCss = ` | ||
position: fixed; | ||
left:50%; | ||
`; | ||
innerCss = ` | ||
position: relative; | ||
left:-50%; | ||
`; | ||
} | ||
return { | ||
css: { | ||
modal: modalCss, | ||
inner: innerCss | ||
} | ||
}; | ||
} | ||
function main(options) { | ||
const { | ||
position | ||
} = options; | ||
const { | ||
text, | ||
buttonText, | ||
buttonCallback | ||
} = options; | ||
const { | ||
css | ||
} = build(position); | ||
return `<div style='${css.modal}'> | ||
<div style='${css.inner}'> | ||
${text} | ||
<button onclick=${buttonCallback}>${buttonText}</button> | ||
</div> | ||
</div>`; | ||
} | ||
exports.main = main; | ||
//# sourceMappingURL=index.js.map |
@@ -1,16 +0,12 @@ | ||
/* | ||
* | ||
* 🐹 Oh hi there! Welcome to your brand new pika package! | ||
* | ||
* If this is your first time, take a second to familiarize yourself with the editor. | ||
* Then, whenever you're ready, delete all of this and start writing! | ||
* | ||
* We can't wait to see what you build! | ||
* | ||
* Yours, | ||
* The Pika Team | ||
*/ | ||
// PS: Here's a dumb placeholder function to help you get started: | ||
export function main() { | ||
return `<div>Cookie consent banner here.</div>`; | ||
import build from './build'; | ||
export function main(options) { | ||
const { position } = options; | ||
const { text, buttonText, buttonCallback } = options; | ||
const { css } = build(position); | ||
return `<div style='${css.modal}'> | ||
<div style='${css.inner}'> | ||
${text} | ||
<button onclick=${buttonCallback}>${buttonText}</button> | ||
</div> | ||
</div>`; | ||
} |
@@ -1,3 +0,3 @@ | ||
declare function main(): string; | ||
declare function main(options: any): string; | ||
export { main }; |
@@ -1,19 +0,36 @@ | ||
/* | ||
* | ||
* 🐹 Oh hi there! Welcome to your brand new pika package! | ||
* | ||
* If this is your first time, take a second to familiarize yourself with the editor. | ||
* Then, whenever you're ready, delete all of this and start writing! | ||
* | ||
* We can't wait to see what you build! | ||
* | ||
* Yours, | ||
* The Pika Team | ||
*/ | ||
// PS: Here's a dumb placeholder function to help you get started: | ||
function main() { | ||
return `<div>Cookie consent banner here.</div>`; | ||
function build(position) { | ||
let modalCss = ''; | ||
let innerCss = ''; | ||
if (position === 'modal') { | ||
// open the banner as modal | ||
modalCss = ` | ||
position: fixed; | ||
left:50%; | ||
`; | ||
innerCss = ` | ||
position: relative; | ||
left:-50%; | ||
`; | ||
} | ||
return { | ||
css: { | ||
modal: modalCss, | ||
inner: innerCss | ||
} | ||
}; | ||
} | ||
function main(options) { | ||
const { position } = options; | ||
const { text, buttonText, buttonCallback } = options; | ||
const { css } = build(position); | ||
return `<div style='${css.modal}'> | ||
<div style='${css.inner}'> | ||
${text} | ||
<button onclick=${buttonCallback}>${buttonText}</button> | ||
</div> | ||
</div>`; | ||
} | ||
export { main }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@esm/cookie-consent-banner", | ||
"description": "Web-native library for easy & customisable cookie-banners", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
# @hwclass/cookie-consent-banner | ||
A new package. | ||
Web-native library for easy & customisable cookie-banners. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7393
10
116