fix: fixing glitch on dark mode icon

fixing the glitch when reloading the page on dark mode and the icon changing back to light mode.
This commit is contained in:
Lucas Nunes 2024-02-05 21:25:42 -03:00
parent 09ec9f28e3
commit c646eb129c

View File

@ -138,20 +138,19 @@ watch(() => $route.path, (n) => {
<component :is="link.icon" class="w-[20px] h-5" /> <component :is="link.icon" class="w-[20px] h-5" />
</Button> </Button>
<ClientOnly>
<Button <Button
class="flex items-center justify-center" class="flex items-center justify-center"
aria-label="Toggle dark mode" aria-label="Toggle dark mode"
:variant="'ghost'" :variant="'ghost'"
:size="'icon'" @click="toggleDark()" :size="'icon'" @click="toggleDark()"
> >
<!-- workaround for bug with component when refreshing the page -->
<component <component
:is="RadixIconsMoon" :is="isDark ? RadixIconsSun : RadixIconsMoon"
v-if="!isDark"
class="w-[20px] h-5 text-foreground" class="w-[20px] h-5 text-foreground"
/> />
<RadixIconsSun v-if="isDark" class="w-[20px] h-5 text-foreground" />
</Button> </Button>
</ClientOnly>
</div> </div>
</div> </div>
</div> </div>