diff --git a/changelog.md b/changelog.md
index 02b9475..722f552 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,12 @@
# Changelog
+## 2025-01-22 - 1.6.0 - feat(elements)
+Enhance theme handling and CSS organization for consent component
+
+- Introduced theme-specific CSS variables for better theming support in consentsoftware-cookieconsent.
+- Reorganized styles in consentsoftware-cookieconsent for cleaner look and consistency.
+- Added media queries for responsive design in consentsoftware-tabs.
+
## 2025-01-21 - 1.5.4 - fix(consentsoftware-components)
Add interactive consent software components for managing cookie levels.
diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts
index 76c0fd9..b5963cd 100644
--- a/ts_web/00_commitinfo_data.ts
+++ b/ts_web/00_commitinfo_data.ts
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@consent.software/catalog',
- version: '1.5.4',
+ version: '1.6.0',
description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
}
diff --git a/ts_web/elements/consentsoftware-cookieconsent.ts b/ts_web/elements/consentsoftware-cookieconsent.ts
index 38e4fe7..6e60a24 100644
--- a/ts_web/elements/consentsoftware-cookieconsent.ts
+++ b/ts_web/elements/consentsoftware-cookieconsent.ts
@@ -21,18 +21,20 @@ export class ConsentsoftwareCookieconsent extends LitElement {
public csWebclientInstance = new csWebclient.CsWebclient();
public csWebclientRan = false;
+ // Reflects the current theme ('light' or 'dark')
@property({ type: String, reflect: true })
public theme: 'light' | 'dark' = 'light';
/**
- * We bind `heightPixels` to a CSS variable (--cookieconsent-height).
- * Then we can do margin-bottom animations in CSS.
+ * Define component styles with CSS variables that adjust based on theme.
+ * The default variables serve as baseline for the light theme.
+ * Theme-specific overrides modify these for dark mode.
*/
public static styles = css`
:host {
font-family: ${shared.fontStack};
user-select: none;
- /* Default theme variables */
+ /* Default variables for Light Theme */
--text-color: #333;
--background-color: #eeeeee;
--accent-color: #333333;
@@ -41,8 +43,14 @@ export class ConsentsoftwareCookieconsent extends LitElement {
--icon-color: #4496f5;
--link-color: #333;
--padding-sides: 16px;
+ /* Additional variables for modal and info container styling */
+ --info-bg: rgba(0, 0, 0, 0.1);
+ --info-text: rgba(255, 255, 255, 0.5);
+ --modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}
+ /* Dark Theme Overrides:
+ When theme attribute is 'dark', override variables accordingly. */
:host([theme='dark']) {
--text-color: #fff;
--background-color: #111;
@@ -51,8 +59,14 @@ export class ConsentsoftwareCookieconsent extends LitElement {
--button-hover-bg: #222222;
--icon-color: #4496f5;
--link-color: #fff;
+ --info-bg: rgba(0, 0, 0, 0.1);
+ --info-text: rgba(255, 255, 255, 0.5);
+ --modal-box-shadow: 0px 0px 8px rgba(255, 255, 255, 0.6);
}
+ /* Light Theme Overrides:
+ Explicit light theme settings, currently matching defaults.
+ Can be customized independently if desired. */
:host([theme='light']) {
--text-color: #333;
--background-color: #eeeeee;
@@ -61,33 +75,39 @@ export class ConsentsoftwareCookieconsent extends LitElement {
--button-hover-bg: #f2f2f2;
--icon-color: #4496f5;
--link-color: #333;
+ --info-bg: rgba(0, 0, 0, 0.1);
+ --info-text: rgba(0, 0, 0, 0.5);
+ --modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}
+ /* Overlay covering the page behind the modal */
.pageOverlay {
position: fixed;
- top: 0px;
- bottom: 0px;
- right: 0px;
- left: 0px;
+ top: 0;
+ bottom: 0;
+ right: 0;
+ left: 0;
display: grid;
align-items: center;
justify-content: center;
- z-index: 1000; /* standard z-index for fixed elements */
+ z-index: 1000; /* Ensures the overlay is on top of other elements */
background: rgba(255, 255, 255, 0);
backdrop-filter: blur(0px);
transition: all 0.2s;
}
+ /* Shake animation for overlay when clicked */
.pageOverlay.shake {
background: rgba(0, 0, 0, 0.5) !important;
}
+ /* Modal box styling using theme variables for colors and shadows */
.modalBox {
display: block;
color: var(--text-color);
background: var(--background-color);
- box-shadow: 0px 0px 8px rgba(255, 255, 255, 0.6);
- position: realtive;
+ box-shadow: var(--modal-box-shadow);
+ position: relative;
border: 1px dotted rgba(255, 255, 255, 0.1);
border-top: 1px solid var(--accent-color);
border-radius: 16px;
@@ -95,12 +115,22 @@ export class ConsentsoftwareCookieconsent extends LitElement {
min-width: calc(100vw / 3);
box-sizing: border-box;
overflow: hidden;
- will-change: transform; /* ensure efficient rendering */
+ will-change: transform;
transition: all 0.3s;
transform: scale(0.95);
opacity: 0;
}
+ /* Media query for mobile devices: stack buttons vertically */
+ @media (max-width: 600px) {
+ .modalBox {
+ height: 100vh;
+ box-shadow: none;
+ border-radius: 0px;
+ }
+ }
+
+ /* Shake animation for modal box */
.modalBox.shake {
animation: shake 150ms 2 linear;
}
@@ -117,10 +147,7 @@ export class ConsentsoftwareCookieconsent extends LitElement {
}
}
- /*
- * Toggle display based on [show] attribute
- * (so if show=false, the banner doesn't show at all).
- */
+ /* Toggle display based on [show] attribute */
:host([show='false']) {
display: none;
}
@@ -151,25 +178,14 @@ export class ConsentsoftwareCookieconsent extends LitElement {
gap: 16px;
}
- .info-container {
- color: var(--text-color);
- text-align: center;
- line-height: 3em;
- background: rgba(0, 0, 0, 0.1);
- border-top: 1px dotted rgba(255, 255, 255, 0.1);
- font-size: 0.8em;
- color: rgba(255, 255, 255, 0.5);
- }
-
- .info-container a {
- text-decoration: underline;
- color: var(--link-color);
- transition: color 0.2s;
- }
- .info-container a:hover {
- color: #ffffff;
+ /* Media query for mobile devices: stack buttons vertically */
+ @media (max-width: 600px) {
+ .button-container {
+ grid-template-columns: 1fr;
+ }
}
+ /* Consent button styling using theme variables */
.consent-button {
border-radius: 3px;
background: var(--button-bg);
@@ -184,10 +200,30 @@ export class ConsentsoftwareCookieconsent extends LitElement {
.consent-button:hover {
background: var(--button-hover-bg);
}
+
+ /* Use theme variables for info container background and text */
+ .info-container {
+ text-align: center;
+ line-height: 3em;
+ background: var(--info-bg);
+ border-top: 1px dotted rgba(255, 255, 255, 0.1);
+ font-size: 0.8em;
+ color: var(--info-text);
+ }
+
+ .info-container a {
+ text-decoration: underline;
+ color: var(--link-color);
+ transition: color 0.2s;
+ }
+ .info-container a:hover {
+ color: #ffffff;
+ }
`;
constructor() {
super();
+ // Initially hide the consent banner until needed
this.setAttribute('show', 'false');
}
@@ -205,36 +241,6 @@ export class ConsentsoftwareCookieconsent extends LitElement {
and choose which cookie level you are willing to accept.
-