-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f528de5
commit 31ed979
Showing
3 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
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,11 +1,10 @@ | ||
<script setup lang="ts"> | ||
const isDark = useDark() | ||
const toggleDark = useToggle(isDark) | ||
import { useMyDark } from '~/composables/dark'; | ||
const [_, toggleDark] = useMyDark(); | ||
</script> | ||
|
||
<template> | ||
<button class="cursor-pointer text-white bg-transparent py-0.75 px-2.5 text-sm" @click="toggleDark()"> | ||
<span class="inline-block align-middle dark:i-carbon-moon i-carbon-sun" /> | ||
<!-- <span class="pl-2">{{ isDark ? 'Dark' : 'Light' }}</span> --> | ||
</button> | ||
</template> |
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,14 @@ | ||
const isDarkRef = ref(false); | ||
|
||
const isDark = useDark() | ||
const toggleDark = useToggle(isDark) | ||
isDarkRef.value = isDark.value; | ||
|
||
export function useMyDark() { | ||
const toggleDarkWrapped = () => { | ||
toggleDark(); | ||
isDarkRef.value = isDark.value; | ||
} | ||
|
||
return [isDarkRef, toggleDarkWrapped] as const; | ||
} |