Skip to content

Commit 1e31b60

Browse files
authored
Add theme toggle and update/fix styling (#166)
1 parent 914e376 commit 1e31b60

File tree

9 files changed

+53
-79
lines changed

9 files changed

+53
-79
lines changed

curriculum-front/src/App.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<v-app>
3-
<TopNav :openDrawer="openDrawer" />
2+
<v-app :theme="theme">
3+
<TopNav :openDrawer="openDrawer" v-model:theme="theme" />
44
<MobileDrawer />
55

6-
<v-content mb-8>
6+
<v-content>
77
<RouterView />
88
</v-content>
99
<v-snackbar v-model="snackbarOptions.show" :multi-line="true" :right="true" :top="true" :timeout="6000"
@@ -20,7 +20,7 @@
2020
</template>
2121

2222
<script setup>
23-
import { toRefs } from 'vue'
23+
import { ref, toRefs } from 'vue'
2424
import { RouterView } from 'vue-router'
2525
import { useGeneralStore } from '@/stores/general'
2626
@@ -29,4 +29,5 @@ import MobileDrawer from '@/components/MobileDrawer.vue'
2929
3030
const generalStore = useGeneralStore()
3131
const { snackbarOptions, isLoading } = toRefs(generalStore)
32+
const theme = ref('light')
3233
</script>

curriculum-front/src/assets/main.css

-35
This file was deleted.

curriculum-front/src/components/TopNav.vue

+19-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
<v-spacer></v-spacer>
1313

14+
<v-btn :prepend-icon="theme === 'light' ? 'mdi-weather-sunny' : 'mdi-weather-night'" text="Toggle Theme" slim
15+
@click="toggleTheme" variant="outlined" class="mr-4" />
16+
1417
<v-toolbar-items v-if="mobile">
1518
<v-btn @click="openDrawer()">
1619
Menu
@@ -27,13 +30,13 @@
2730
<v-btn v-if="user.token" to="/curricula/create" text>
2831
Create
2932
</v-btn>
30-
<v-btn v-if="!user.token" to="/login" color="secondary" class="black--text">
33+
<v-btn v-if="!user.token" to="/login">
3134
Log In
3235
</v-btn>
3336

3437
<v-menu v-else left bottom offset-y>
3538
<template v-slot:activator="{ on }">
36-
<v-btn v-on="on" color="secondary" class="black--text">
39+
<v-btn v-on="on" color="secondary">
3740
<v-icon left>mdi-account-outline</v-icon>
3841
{{ user.username }}
3942
</v-btn>
@@ -67,4 +70,18 @@ const logout = () => {
6770
6871
const authStore = useAuthStore()
6972
const { user } = toRefs(authStore)
73+
74+
const props = defineProps({
75+
theme: {
76+
type: String,
77+
required: true,
78+
}
79+
})
80+
81+
const emit = defineEmits(['update:theme'])
82+
83+
function toggleTheme() {
84+
const newTheme = props.theme === 'light' ? 'dark' : 'light'
85+
emit('update:theme', newTheme)
86+
}
7087
</script>

curriculum-front/src/main.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'vuetify/styles'
22
import '@mdi/font/css/materialdesignicons.css'
3-
import './assets/main.css'
43
import './sass/index.sass'
54

65
import { createApp } from 'vue'

curriculum-front/src/views/auth/AuthTemplate.vue

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
<v-row class="auth-wrapper mt-10">
33
<v-col md="4" offset-md="4" sm="6" offset-sm="3" cols="12">
44
<v-form class="create-form">
5-
<v-card>
6-
<v-card-subtitle>
5+
<v-card variant="outlined">
6+
<v-card-title class="mb-2">
77
<h3 class="title">
88
<slot name="title"></slot>
99
</h3>
10-
</v-card-subtitle>
11-
<v-card-text>
10+
</v-card-title>
11+
<v-card-text class="pb-0">
1212
<slot name="form"></slot>
1313
</v-card-text>
14-
<v-card-actions>
15-
<slot name="actions"></slot>
14+
<v-card-actions class="pl-1">
15+
<v-col>
16+
<slot name="actions"></slot>
17+
<slot name="link"></slot>
18+
</v-col>
1619
</v-card-actions>
17-
<slot name="link"></slot>
1820
</v-card>
1921
</v-form>
2022
</v-col>

curriculum-front/src/views/auth/ForgotPassword.vue

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
Forgot Password
55
</template>
66
<template #form>
7-
<v-text-field
8-
label="Email"
9-
v-model="email"
10-
/>
7+
<v-text-field label="Email" v-model="email" variant="outlined" />
118
</template>
129
<template #actions>
13-
<v-btn @click="submit" color="primary">Submit</v-btn>
10+
<v-btn @click="submit" color="primary" variant="outlined">Submit</v-btn>
1411
</template>
1512
<template #link>
16-
<p class="pa-2">Don't have an account? <router-link :to="{name: 'register'}">Register here</router-link></p>
13+
<p class="mb-1 mt-4">Don't have an account? <router-link :to="{ name: 'register' }">Register here</router-link>
14+
</p>
1715
</template>
1816
</AuthTemplate>
1917
</template>

curriculum-front/src/views/auth/Login.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
Login
55
</template>
66
<template #form>
7-
<v-text-field label="Email" v-model="email" :error-messages="emailErrors" required />
8-
<v-text-field label="Password" v-model="password" :error-messages="passwordErrors" required />
7+
<v-text-field label="Email" v-model="email" :error-messages="emailErrors" required variant="outlined" />
8+
<v-text-field label="Password" v-model="password" :error-messages="passwordErrors" required variant="outlined" />
99
</template>
1010
<template #actions>
11-
<v-btn @click="submit" color="primary">Submit</v-btn>
11+
<v-btn @click="submit" color="primary" variant="outlined">Submit</v-btn>
1212
</template>
1313
<template #link>
14-
<p class="pa-2 mb-n1">Forgot Password? <router-link :to="{ name: 'forgot-password' }">Update password
14+
<p class="mb-1 mt-4">Forgot Password? <router-link :to="{ name: 'forgot-password' }">Update password
1515
here</router-link></p>
16-
<p class="pa-2">Don't have an account? <router-link :to="{ name: 'register' }">Register here</router-link></p>
16+
<p>Don't have an account? <router-link :to="{ name: 'register' }">Register here</router-link></p>
1717
</template>
1818
</AuthTemplate>
1919
</template>

curriculum-front/src/views/auth/Register.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
Register
55
</template>
66
<template #form>
7-
<v-text-field label="Username" v-model="username" required />
8-
<v-text-field label="Email" v-model="email" required />
9-
<v-text-field label="Password" v-model="password" required />
7+
<v-text-field label="Username" v-model="username" required variant="outlined" />
8+
<v-text-field label="Email" v-model="email" required variant="outlined" />
9+
<v-text-field label="Password" v-model="password" required variant="outlined" />
1010
</template>
1111
<template #actions>
12-
<v-btn @click="submit" color="primary">Submit</v-btn>
12+
<v-btn @click="submit" color="primary" variant="outlined">Submit</v-btn>
1313
</template>
1414
<template #link>
15-
<p class="pa-2">Already have an account? <router-link :to="{ name: 'login' }">Login here</router-link></p>
15+
<p class="mb-1 mt-4">Already have an account? <router-link :to="{ name: 'login' }">Login here</router-link></p>
1616
</template>
1717
</AuthTemplate>
1818
</template>

curriculum-front/src/views/auth/ResetPassword.vue

+6-14
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,16 @@
44
Reset Password
55
</template>
66
<template #form>
7-
<v-text-field
8-
label="Code"
9-
v-model="code"
10-
/>
11-
<v-text-field
12-
label="New Password"
13-
v-model="password"
14-
/>
15-
<v-text-field
16-
label="Confirm Password"
17-
v-model="confirmPassword"
18-
/>
7+
<v-text-field label="Code" variant="outlined" v-model="code" />
8+
<v-text-field label="New Password" variant="outlined" v-model="password" />
9+
<v-text-field label="Confirm Password" variant="outlined" v-model="confirmPassword" />
1910
</template>
2011
<template #actions>
21-
<v-btn @click="submit" color="primary">Submit</v-btn>
12+
<v-btn @click="submit" color="primary" variant="outlined">Submit</v-btn>
2213
</template>
2314
<template #link>
24-
<p class="pa-2">Don't have an account? <router-link :to="{name: 'register'}">Register here</router-link></p>
15+
<p class="mb-1 mt-4">Don't have an account? <router-link :to="{ name: 'register' }">Register here</router-link>
16+
</p>
2517
</template>
2618
</AuthTemplate>
2719
</template>

0 commit comments

Comments
 (0)