Skip to content

Commit d06c001

Browse files
committed
Merge #422: Light theme support.
4ee9702 refactor: [#421] light theme improved (Mario) d8d7c49 feat:[#421] added hover effect for buttons (Mario) e917427 refactor: [#421] new component name and added flex (Mario) 300f8c2 feat: [#421] button transition when changing theme (Mario) 9319e3b feat: [#421] system color preference working (Mario) 2e3f421 feat: [#421] custom light theme for DaisyUi added (Mario) 7f26b0b feat: [#421] light dark switch button (Mario) ac91576 feat: [#421] added theme switch functionality (Mario) d4f819e feat: [#421] added placeholder theme switch (Mario) 4424052 feat: [#421] NuxtJs color mode config added (Mario) 69ca328 feat: [#421] NuxtJs color mode installation (Mario) Pull request description: Resolves #421. ACKs for top commit: josecelano: ACK 4ee9702 Tree-SHA512: 3223f68c9cedaa721e6f9bf1b670e4b991ef9c441e957f583b48b8f7d0dbc941e5e6d90138711822330f335f4fcebe2f30ba2fc5c512b928fbbd54aa6ae01da4
2 parents 759d049 + 4ee9702 commit d06c001

File tree

7 files changed

+383
-70
lines changed

7 files changed

+383
-70
lines changed

app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div data-theme="torrust">
2+
<div>
33
<Notifications />
44

55
<NavigationBar />

components/ThemeToggle.vue

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<template>
2+
<div class="flex">
3+
<button v-if="$colorMode.preference === 'system'" @click="$colorMode.preference = 'dark'">
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="24"
7+
height="24"
8+
viewBox="0 0 24 24"
9+
fill="none"
10+
stroke="currentColor"
11+
stroke-width="2"
12+
stroke-linecap="round"
13+
stroke-linejoin="round"
14+
class="feather feather-monitor"
15+
>
16+
<rect
17+
x="2"
18+
y="3"
19+
width="20"
20+
height="14"
21+
rx="2"
22+
ry="2"
23+
/>
24+
<line x1="8" y1="21" x2="16" y2="21" />
25+
<line x1="12" y1="17" x2="12" y2="21" />
26+
</svg>
27+
</button>
28+
<button v-if="$colorMode.preference === 'dark'" @click="$colorMode.preference = 'light'">
29+
<svg
30+
xmlns="http://www.w3.org/2000/svg"
31+
width="24"
32+
height="24"
33+
viewBox="0 0 24 24"
34+
fill="none"
35+
stroke="currentColor"
36+
stroke-width="2"
37+
stroke-linecap="round"
38+
stroke-linejoin="round"
39+
class="feather feather-moon"
40+
>
41+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
42+
</svg>
43+
</button>
44+
<button v-if="$colorMode.preference === 'light'" @click="$colorMode.preference = 'system'">
45+
<svg
46+
xmlns="http://www.w3.org/2000/svg"
47+
width="24"
48+
height="24"
49+
viewBox="0 0 24 24"
50+
fill="none"
51+
stroke="currentColor"
52+
stroke-width="2"
53+
stroke-linecap="round"
54+
stroke-linejoin="round"
55+
class="feather feather-sun"
56+
>
57+
<circle cx="12" cy="12" r="5" />
58+
<line x1="12" y1="1" x2="12" y2="3" />
59+
<line x1="12" y1="21" x2="12" y2="23" />
60+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
61+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
62+
<line x1="1" y1="12" x2="3" y2="12" />
63+
<line x1="21" y1="12" x2="23" y2="12" />
64+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
65+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
66+
</svg>
67+
</button>
68+
</div>
69+
</template>
70+
71+
<script setup lang="ts">
72+
73+
</script>
74+
75+
<style scoped>
76+
.feather:hover {
77+
stroke: orange;
78+
stroke-opacity: 75%;
79+
}
80+
</style>

components/navigation/NavigationBar.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</div>
3838
<div class="flex-none gap-2 ml-auto">
3939
<template v-if="user">
40-
<NuxtLink to="/upload" class="hidden md:flex btn bg-base-100 rounded-2xl">
40+
<NuxtLink id="upload-button" to="/upload" class="hidden md:flex btn bg-base-100 rounded-2xl">
4141
Upload Torrent
4242
</NuxtLink>
4343
<div data-cy="user-menu" class="dropdown dropdown-end z-[1]">
@@ -62,6 +62,7 @@
6262
Sign Up
6363
</NuxtLink>
6464
</template>
65+
<ThemeToggle />
6566
</div>
6667
</div>
6768
<template v-if="!mobileCollapsed">
@@ -133,4 +134,8 @@ function submitSearch () {
133134
#mobile-menu a.router-link-exact-active {
134135
@apply bg-primary;
135136
}
137+
138+
[data-theme="light"] #upload-button {
139+
background-color: #ffffff;
140+
}
136141
</style>

nuxt.config.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@ export default defineNuxtConfig({
1111
},
1212

1313
modules: [
14-
"@nuxtjs/tailwindcss"
14+
"@nuxtjs/tailwindcss",
15+
"@nuxtjs/color-mode"
1516
],
1617

18+
colorMode: {
19+
preference: "dark", // default value of $colorMode.preference
20+
fallback: "dark", // fallback value if not system preference found
21+
hid: "nuxt-color-mode-script",
22+
globalName: "__NUXT_COLOR_MODE__",
23+
componentName: "ColorScheme",
24+
classPrefix: "",
25+
classSuffix: "",
26+
storageKey: "nuxt-color-mode",
27+
dataValue: "theme"
28+
},
29+
1730
vite: {
1831
server: {
1932
fs: {

0 commit comments

Comments
 (0)