1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<template>
<v-app @keyup.shift.tab="toggleDrawer" :style="bg">
<v-navigation-drawer temporary v-model="drawer" location="right"
><v-list density="compact" nav>
<v-list-item
prepend-icon="mdi-home"
title="Home"
value="home"
@click="
atHome = true;
atEdit = false;
atSettings = false;
"
></v-list-item>
<v-list-item
prepend-icon="mdi-pencil"
title="Edit"
value="edit"
@click="
atHome = false;
atEdit = true;
atSettings = false;
"
></v-list-item>
<v-list-item
prepend-icon="mdi-cog-outline"
title="Settings"
value="settings"
@click="
atHome = false;
atEdit = false;
atSettings = true;
"
></v-list-item>
<v-list-item
prepend-icon="mdi-theme-light-dark"
title="Theme"
value="theme"
@click="toggleTheme"
></v-list-item> </v-list
></v-navigation-drawer>
<v-snackbar color="grey" v-model="snackbar">
{{ snackbarText }}
<template v-slot:actions>
<v-btn variant="snackbarText" @click="snackbar = false"> Close </v-btn>
</template>
</v-snackbar>
<v-main>
<v-container class="float-end w-50">
<HomePage v-if="atHome" />
<EditPage v-if="atEdit" @snackbar-notification="setSnackbarText" />
<SettingsPage v-if="atSettings" />
</v-container>
</v-main>
</v-app>
</template>
<script>
import { useTheme } from "vuetify";
import HomePage from "./components/HomePage.vue";
import EditPage from "./components/EditPage.vue";
import SettingsPage from "./components/SettingsPage.vue";
export default {
name: "App",
components: {
HomePage,
EditPage,
SettingsPage,
},
data: () => ({
drawer: null,
atHome: true,
atEdit: false,
atSettings: false,
snackbar: false,
snackbarText: "Default snackbar text (End-user shouldn't see this)",
bg: {
backgroundColor: "grey",
// backgroundImage: "url(https://wallpapercave.com/wp/wp9649930.jpg)",
backgroundPosition: "center",
},
}),
setup() {
const theme = useTheme();
return {
theme,
toggleTheme: () =>
(theme.global.name.value = theme.global.current.value.dark
? "light"
: "dark"),
};
},
methods: {
toggleDrawer() {
this.drawer = !this.drawer;
},
setSnackbarText(text) {
this.snackbarText = text;
this.snackbar = true;
},
},
};
</script>
|