feat(static): colorize weather icons

This commit is contained in:
2026-07-22 22:15:08 +03:00
parent 6171ec8a26
commit 0a734f9c43
39 changed files with 433 additions and 889 deletions
@@ -0,0 +1,22 @@
export class WeatherIconElement extends HTMLElement {
static iconsPath = "./icons";
static observedAttributes = ["icon"];
constructor() {
super();
const icon = this.getAttribute("icon");
if (icon) {
this.icon = icon;
}
}
set icon(value: string) {
console.log('!', WeatherIconElement.iconsPath);
const src = `${WeatherIconElement.iconsPath}/wi-${value}.svg`;
fetch(src)
.then((response) => response.text())
.then((data) => (this.innerHTML = data));
}
}