-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";
5
4
6
5
Alpine.data("homePageState", () => ({
7
6
friends: [
···
44
43
goto(newLocation: string) {
45
44
window.location.href =
46
45
"/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");
62
46
},
63
47
}));
64
48
+1
-1
app/src/settings-page/settings.html
+1
-1
app/src/settings-page/settings.html
+20
app/src/utils/tools.ts
+20
app/src/utils/tools.ts
···
3
3
"/src/" + newLocation + "-page/" + newLocation + ".html";
4
4
}
5
5
6
+
/*
7
+
8
+
Use this type of function to toggle dark mode. It CAN be modified to your needs. copy the function, and fix the end comment(be sure to put this in the alpine section)
9
+
10
+
toggleDarkMode() {
11
+
/*
12
+
This toggles darkmode for 'body' in the css file | use for only document types
13
+
document.body.classList.toggle("dark-theme");
14
+
15
+
this toggles darkmode for '.app' in the css file | use if it isn't a document type
16
+
toggleStyle("app", "dark-theme");
17
+
18
+
* /
19
+
20
+
document.body.classList.toggle("dark-theme");
21
+
toggleStyle("header", "dark-theme");
22
+
toggleStyle([".app", ".friend-card", ".content"], "dark-theme");
23
+
},
24
+
*/
25
+
6
26
export function toggleStyle(classNames: string | string[], newClass: string) {
7
27
if (typeof classNames === "string") {
8
28
for (