27 lines
755 B
Vue
27 lines
755 B
Vue
<script setup lang="ts">
|
|
import { inject } from 'vue'
|
|
import { SunIcon, MoonIcon } from 'lucide-vue-next'
|
|
|
|
const isDarkMode = inject('isDarkMode') as { value: boolean }
|
|
const toggleTheme = inject('toggleTheme') as () => void
|
|
|
|
const toggleColorMode = () => {
|
|
toggleTheme()
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<button
|
|
@click="toggleColorMode"
|
|
class="rounded-full p-2 shadow-sm transition-all duration-500 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-[#8fb2bf] focus:ring-offset-2 transform hover:rotate-180"
|
|
:class="
|
|
isDarkMode
|
|
? 'bg-[#263941] text-[#d8c98e]'
|
|
: 'bg-[#edf4f5] text-[#4f6c75]'
|
|
"
|
|
>
|
|
<SunIcon v-if="!isDarkMode" class="w-6 h-6" />
|
|
<MoonIcon v-else class="w-6 h-6" />
|
|
</button>
|
|
</template>
|