feat(list): use css instead of JS to change ThemeController icon

This commit is contained in:
Kim, Jimin 2025-03-23 08:14:35 +09:00
parent 7ef199ec0e
commit e87be431c5
Signed by: pomp
GPG key ID: D3932F82A0667A3B

View file

@ -1,23 +1,19 @@
<script setup> <script setup>
const colorMode = useColorMode() const colorMode = useColorMode()
const icon = computed(() => {
switch (colorMode.preference) {
case "system":
return "material-symbols:monitor-outline"
case "dark":
return "material-symbols:moon-stars-outline"
case "light":
return "material-symbols:sunny-outline-rounded"
default:
return "material-symbols:monitor-outline"
}
})
</script> </script>
<template> <template>
<div class="flex gap-2"> <div class="flex items-center gap-2">
<Icon :name="icon" size="32" /> <Icon
class="block dark:hidden"
name="material-symbols:sunny-outline-rounded"
size="24"
/>
<Icon
class="hidden dark:block"
name="material-symbols:moon-stars-outline"
size="24"
/>
<select <select
v-model="colorMode.preference" v-model="colorMode.preference"