+5
app/src/home-page/home.css
+5
app/src/home-page/home.css
+2
app/src/home-page/home.html
+2
app/src/home-page/home.html
+16
app/src/home-page/home.ts
+16
app/src/home-page/home.ts
···
1
1
import Alpine from "alpinejs";
2
2
import { Store } from "../utils/store.ts";
3
3
import { post } from "../utils/api.ts";
4
+
import { toggleStyle } from "../utils/tools.ts";
4
5
5
6
Alpine.data("homePageState", () => ({
6
7
friends: [
···
43
44
goto(newLocation: string) {
44
45
window.location.href =
45
46
"/src/" + newLocation + "-page/" + newLocation + ".html";
47
+
},
48
+
49
+
toggleDarkMode() {
50
+
/*
51
+
This toggles darkmode for 'body' in the css file | use for only document types
52
+
document.body.classList.toggle("dark-theme");
53
+
54
+
this toggles darkmode for '.app' in the css file | use if it isn't a document type
55
+
toggleStyle("app", "dark-theme");
56
+
57
+
*/
58
+
59
+
document.body.classList.toggle("dark-theme");
60
+
toggleStyle("header", "dark-theme");
61
+
toggleStyle([".app", ".friend-card", ".content"], "dark-theme");
46
62
},
47
63
}));
48
64