Auto Theme Fixes

Fixed an issue where the Sensitve Content Warning Module did not
automatically update to `dark` theme when `theme-auto` was applied.
This commit is contained in:
Seth Cottle 2025-03-16 21:33:33 -04:00
parent c99d8fd702
commit 41d213855d
2 changed files with 78 additions and 51 deletions

View file

@ -1,11 +1,15 @@
# LittleLink Extended Version History # LittleLink Extended Version History
## Current Version: v3.1.0 ## Current Version: v3.1.1
### v3.1.1 - 03/16/2025
- Fixed an issue where the Sensitve Content Warning Module did not
automatically update to `dark` theme when `theme-auto` was applied.
### v3.1.0 - 03/16/2025 ### v3.1.0 - 03/16/2025
- Added Babylist button - Added Babylist button
- Fixed SimpleX Chat Alt - Fixed SimpleX Chat Alt
- Added Sensitve Content Warning Modile - Added Sensitve Content Warning Module
- Adds `JS` folder with `sensitive-content.js` - Adds `JS` folder with `sensitive-content.js`
- Adds a new `css` file for `sensitve-content.css` - Adds a new `css` file for `sensitve-content.css`
- Adds a new `generic-warning.svg` - Adds a new `generic-warning.svg`

View file

@ -1,63 +1,86 @@
/* Optional "Sensitive Content" Slide-Down Panel /* Optional "Sensitive Content" Slide-Down Panel
---------------------------------------------- ------------------------------------------------
By default, it's collapsed (max-height: 0) and By default, it's collapsed (max-height: 0) and
pushes content down in normal flow when open. pushes content down in normal flow when open.
*/ */
/* Sensitive Warning Button Styling */ /* This defaults to a red button style, but you can use any
button styling from `brands.css` or `brands-extended`.css
or create your own! */
.button-sensitive { .button-sensitive {
--button-text:#ffffff; --button-text: #ffffff;
--button-background:#D72638; --button-background: #D72638;
--button-border:1px solid #ffffff; --button-border: 1px solid #ffffff;
} }
/* Container so everything is grouped nicely */ /* 1) Container */
.slide-container { .slide-container {
margin: 0; /* We let the .button margin handle spacing */ margin: 0;
} }
/* The slide-down panel starts collapsed */ /* 2) The slide-down panel starts collapsed */
.sensitive-panel { .sensitive-panel {
margin-top: -1rem; margin-top: -1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
max-height: 0; max-height: 0;
overflow: hidden; overflow: hidden;
transition: max-height 0.3s ease; transition: max-height 0.3s ease;
border: none; border: none;
border-radius: 0.5rem; border-radius: 0.5rem;
} }
/* When open, show border and expand */ /* 3) When open, show border and expand */
.sensitive-panel.open { .sensitive-panel.open {
max-height: 300px; max-height: 300px;
border: 1px solid #ccc; border: 1px solid #ccc;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
/* The panel's content area */ /* 4) The panel's content area */
.sensitive-panel__content { .sensitive-panel__content {
position: relative; position: relative;
background-color: #fff; background-color: #fff;
color: #000; color: #000;
padding: 1rem; padding: 1rem;
box-sizing: border-box; box-sizing: border-box;
} }
/* Basic spacing inside the panel */ /* Basic spacing inside the panel */
.sensitive-panel__content p { .sensitive-panel__content p {
margin: 1rem 0; margin: 1rem 0;
} }
.sensitive-panel__content .button {
margin-top: 1rem;
}
.sensitive-panel__content .button { /* ------------------------------------
margin-top: 1rem; Dark theme support (forced .theme-dark)
} ------------------------------------ */
:root.theme-dark .sensitive-panel__content {
background-color: #121212;
color: #ffffff;
}
:root.theme-dark .sensitive-panel.open {
border-color: #444;
}
/* Dark theme support */ /* ------------------------------------
:root.theme-dark .sensitive-panel__content { Auto theme support (.theme-auto):
Light by default, switch on system dark
------------------------------------ */
/* Light defaults if system is light */
:root.theme-auto .sensitive-panel__content {
background-color: #fff;
color: #000;
}
/* Dark overrides if system is dark */
@media (prefers-color-scheme: dark) {
:root.theme-auto .sensitive-panel__content {
background-color: #121212; background-color: #121212;
color: #ffffff; color: #ffffff;
} }
:root.theme-dark .sensitive-panel.open { :root.theme-auto .sensitive-panel.open {
border-color: #444; border-color: #444;
} }
}