Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Theme in Login Page #60

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ declare module 'vue' {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Sidebar: typeof import('./components/Sidebar.vue')['default']
ThemeSwitch: typeof import('./components/ThemeSwitch.vue')['default']
UserProfile: typeof import('./components/UserProfile.vue')['default']
}
}
23 changes: 1 addition & 22 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import {
PanelLeftContract16Regular as CollapseIcon,
WeatherMoon48Regular as MoonIcon,
PanelLeftExpand20Regular as OpenIcon,
WeatherSunny48Regular as SunIcon,
} from '@vicons/fluent'

const layoutStore = useLayoutStore()
const { collapsed } = storeToRefs(layoutStore)

Check warning on line 5 in src/components/Navbar.vue

View workflow job for this annotation

GitHub Actions / lint

'collapsed' is assigned a value but never used. Allowed unused vars must match /^_/u
</script>

<template>
<n-page-header class="p-2 navbar">
<template #title>
<n-button mx-2 text size="small" circle @click="layoutStore.toggleSidebar">
<template #icon>
<n-icon size="1.4rem">
<OpenIcon v-if="collapsed" />
<CollapseIcon v-else />
</n-icon>
</template>
</n-button>
<ThemeSwitch />
</template>
<template #extra>
<div class="flex items-center">
<n-button text circle @click="layoutStore.toggleTheme()">
<template #icon>
<NIcon size="1.4rem">
<SunIcon v-if="isDark" />
<MoonIcon v-else />
</NIcon>
</template>
</n-button>
<div class="mx-2">
<LanguageSelect />
</div>
Expand Down
21 changes: 21 additions & 0 deletions src/components/ThemeSwitch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang='ts'>
import {
WeatherMoon48Regular as MoonIcon,
WeatherSunny48Regular as SunIcon,
} from '@vicons/fluent'

const layoutStore = useLayoutStore()
</script>

<template>
<n-button text circle @click="layoutStore.toggleTheme()">
<template #icon>
<NIcon size="1.4rem">
<SunIcon v-if="isDark" />
<MoonIcon v-else />
</NIcon>
</template>
</n-button>
</template>

<style scoped lang='scss'></style>
3 changes: 2 additions & 1 deletion src/pages/Account/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ meta:
</div>
</div>
</div>
<div class="mt-3">
<div class="mt-3 flex justify-between items-center">
<LanguageSelect />
<ThemeSwitch class="mr-2" />
</div>
</div>
</div>
Expand Down
Loading