Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added shadow customization and width editing for cookie banner #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ Now there are certain parameters that you can change to customize your banner.
| `manageColor` | String | Example: `"#fff"` Example: `"white"` |
| `manageBackground` | String | Example: `"#f2f2f2"` Example: `"blue"` |
| `manageText` | String | Example: `"Manage cookies"` |
| `maxWidth` | String | Example: `"300px"` |
| `shadowSpread` | String | Example: `"3em"` |
| `shadowColor` | String | Example: `"rgba(255,0,0,.2)"` |


## Fully customized banner
Expand All @@ -124,6 +127,9 @@ Now there are certain parameters that you can change to customize your banner.
bannerBackground: '#000',
bannerColor: '#fafafa',
bannerHeading: '<h2>Cookies</h2>',
shadowSpread: '3em',
shadowColor: 'rgba(100,0,0,.2)',
maxWidth: '500px',
acceptBtnText: 'accept btn text',
acceptBtnColor: 'green',
acceptBtnBackground: 'red',
Expand All @@ -132,7 +138,7 @@ Now there are certain parameters that you can change to customize your banner.
rejectBtnColor: 'blue',
manageColor: 'white',
manageBackground: 'blue',
manageText: 'cookies text'
manageText: 'cookies text',
});
</script>
```
Expand Down
3 changes: 0 additions & 3 deletions src/glowCookies.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
width: auto;
max-width: 375px;
z-index: 999;
-webkit-box-shadow: 0 .625em 1.875em rgba(2,2,3,.2);
-moz-box-shadow: 0 .625em 1.875em rgba(2,2,3,.2);
box-shadow: 0 .625em 1.875em rgba(2,2,3,.2);
transition: transform .2s ease, opacity .2s ease !important;
}

Expand Down
12 changes: 10 additions & 2 deletions src/glowCookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ class GlowCookies {
this.Cookies.innerHTML = `<div
id="glowCookies-banner"
class="glowCookies__banner glowCookies__banner__${this.config.bannerStyle} glowCookies__${this.config.border} glowCookies__${this.config.position}"
style="background-color: ${this.banner.background};"
style="background-color: ${this.banner.background};
-webkit-box-shadow: 0 .625em ${this.banner.shadowSpread} ${this.banner.shadowColor};
-moz-box-shadow: 0 .625em ${this.banner.shadowSpread} ${this.banner.shadowColor};
box-shadow: 0 .625em ${this.banner.shadowSpread} ${this.banner.shadowColor};
max-width: ${this.banner.maxWidth}""
>
<h3 style="color: ${this.banner.color};">${this.banner.heading}</h3>
<p style="color: ${this.banner.color};">
Expand Down Expand Up @@ -272,7 +276,11 @@ class GlowCookies {
color: obj.manageColor || '#1d2e38',
background: obj.manageBackground || '#fff',
text: obj.manageText || lang.manageText,
}
},
shadowSpread: obj.shadowSpread || '1.875em',
shadowColor: obj.shadowColor || 'rgba(255,2,3,.2)',
maxWidth: obj.maxWidth || '375px',

}

// Draw banner
Expand Down