Add basic set of error pages
This commit is contained in:
parent
823284d6ba
commit
d649dc7da3
10 changed files with 115 additions and 41 deletions
|
|
@ -6,18 +6,35 @@ export default class extends Controller {
|
|||
COOKIE_NAME = "modeTheme"
|
||||
|
||||
connect() {
|
||||
console.log("connect switcher")
|
||||
console.log("connect switcher", this.init())
|
||||
}
|
||||
|
||||
init() {
|
||||
const cookieValue = Cookie.get(this.COOKIE_NAME);
|
||||
const newThemeValue = cookieValue == "dark" ? "dark" : "light";
|
||||
|
||||
Cookie.set("init modeTheme", newThemeValue);
|
||||
window.document.getElementsByTagName("html")[0].setAttribute("data-bs-theme", newThemeValue);
|
||||
|
||||
const icon = this.element.getElementsByTagName("i")[0];
|
||||
if (newThemeValue == "dark") {
|
||||
icon.classList.remove("bi-sun-fill")
|
||||
icon.classList.add("bi-moon-stars-fill")
|
||||
} else {
|
||||
icon.classList.add("bi-sun-fill")
|
||||
icon.classList.remove("bi-moon-stars-fill")
|
||||
}
|
||||
}
|
||||
|
||||
switch() {
|
||||
const cookieValue = Cookie.get(this.COOKIE_NAME);
|
||||
const newThemeValue = cookieValue == "dark" ? "light" : "dark";
|
||||
|
||||
|
||||
Cookie.set("modeTheme", newThemeValue);
|
||||
window.document.getElementsByTagName("html")[0].setAttribute("data-bs-theme", newThemeValue);
|
||||
|
||||
const icon = this.element.getElementsByTagName("i")[0];
|
||||
if(newThemeValue == "dark") {
|
||||
if (newThemeValue == "dark") {
|
||||
icon.classList.remove("bi-sun-fill")
|
||||
icon.classList.add("bi-moon-stars-fill")
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue