-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: the frosting effect is implemented in css
- Loading branch information
Showing
9 changed files
with
48 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
<script setup lang="ts"> | ||
import Theme from './components/Theme/index.vue' | ||
import { useAppStore } from '@/stores' | ||
import { useThemeStore } from '@/stores' | ||
import { storeToRefs } from 'pinia' | ||
const { themeMode, themeStyle } = storeToRefs(useAppStore()) | ||
const { themeClass } = storeToRefs(useThemeStore()) | ||
</script> | ||
|
||
<template> | ||
<Suspense> | ||
<div | ||
class="h-screen rounded-xl" | ||
style="background: inherit" | ||
class="app relative h-screen overflow-hidden rounded-2xl" | ||
:class="themeClass" | ||
data-tauri-drag-region | ||
:data-theme="themeMode" | ||
:class="themeStyle" | ||
> | ||
<button class="btn btn-active btn-ghost">Button</button> | ||
|
||
<Theme /> | ||
</div> | ||
</Suspense> | ||
</template> | ||
|
||
<style scoped lang="scss"></style> | ||
<style scoped lang="scss"> | ||
.app { | ||
&::before, | ||
&::after { | ||
@apply -z-1 absolute top-0 left-0 right-0 bottom-0 bg-inherit blur-3xl content-none; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
export enum AppTheme { | ||
light = 'light', | ||
dark = 'dark' | ||
} | ||
export * from './shared' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum APP_THEME { | ||
light = 'light', | ||
dark = 'dark' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1 @@ | ||
import { AppTheme } from '@/constants' | ||
|
||
// @unocss-include | ||
export const useAppStore = defineStore( | ||
'app', | ||
() => { | ||
const themeMode = ref(AppTheme.light) | ||
|
||
const themeStyle = computed(() => | ||
themeMode.value === AppTheme.light ? 'bg-white/50' : 'bg-black/50' | ||
) | ||
|
||
return { themeMode, themeStyle } | ||
}, | ||
{ | ||
persist: true | ||
} | ||
) | ||
export * from './theme' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { APP_THEME } from '@/constants' | ||
|
||
// @unocss-include | ||
export const useThemeStore = defineStore( | ||
'theme', | ||
() => { | ||
const themeMode = ref(APP_THEME.light) | ||
|
||
const themeClass = computed(() => | ||
themeMode.value === APP_THEME.light ? 'bg-white/65' : 'bg-black/65' | ||
) | ||
|
||
watch(themeMode, (newTheme) => { | ||
document.documentElement.setAttribute('data-theme', newTheme) | ||
}) | ||
|
||
return { themeMode, themeClass } | ||
}, | ||
{ | ||
persist: true | ||
} | ||
) |