Comments (7)
Giscus has a bug and is down for next few days.
from angular-challenges.
export class L extends HTMLElement {
#e = "starlight-theme";
constructor() {
super(), this.#n(this.#o());
const e = this.querySelector("select");
e && e.addEventListener("change", n => {
n.currentTarget instanceof HTMLSelectElement && this.#n(this.#t(n.currentTarget.value))
})
}
#t(e) {
return e === "auto" || e === "dark" || e === "light" ? e : "auto"
}
#s() {
return matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"
}
#n(e) {
StarlightThemeProvider.updatePickers(e), document.documentElement.dataset.theme = e === "auto" ? this.#s() : e, this.#r(e)
}
#r(e) {
typeof localStorage < "u" && (e === "light" || e === "dark" ? localStorage.setItem(this.#e, e) : localStorage.removeItem(this.#e))
}
#o() {
const e = typeof localStorage < "u" && localStorage.getItem(this.#e);
return this.#t(e)
}
}
I used the web components extension and this nested ternary is used for the select.
document.documentElement.dataset.theme = e === "auto" ? this.#s() : e, this.#r(e)
Does this look right to you?
from angular-challenges.
I've never used web component, but if it does the job, it's right for me.
from angular-challenges.
I'm thinking now that there maybe a conditional logic error. The issue mentioned attribute binding but the error still occurs when both attributes are correct.
This issue is worth looking at as well.
from angular-challenges.
yes indeed, the change is not done automatically. I need to look at it more closely when I have more time. Or if you want to do it, don't hesitate 😅
from angular-challenges.
This issue is stale because it has been open for 20 days with no activity.
from angular-challenges.
This issue is stale because it has been open for 20 days with no activity.
from angular-challenges.
Related Issues (20)
- Translation ES HOT 5
- Translation PT HOT 4
- Translation file skeleton (TO BE EDITED WHEN NEW CHALLENGE IS ADDED)
- i18n for shared custom components HOT 3
- Translation es-MX HOT 1
- Update Dependencies HOT 1
- Unify Spanish translations HOT 9
- Answer author tag vs answer tag HOT 1
- NgRx Notification directions need clarification HOT 1
- Translation RU HOT 3
- Repo size HOT 5
- Add Angular Challenges to Awesome Angular Repo HOT 2
- Help to start challenges HOT 3
- "forms" option is missing in nx generate schematic UI HOT 5
- Change Angular documentation links to point to angular.dev instead HOT 3
- Missing answer label HOT 1
- Need to add alcaidio to contributors list on main readme HOT 2
- Signal Challenge Series HOT 4
- Tailwind Warning in bug signal challenge HOT 2
- (bug) Sponsors link overflow HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-challenges.