11<script lang =" ts" >
22 import { goto } from " $app/navigation" ;
33 import { modalStore } from " $lib/stores/modal" ;
4+ import { panelStore } from " $lib/stores/panel" ;
45 import { darkTheme , getStyles , isMobile } from " $lib/stores/styles" ;
56 import type { SupabaseClient } from " @supabase/supabase-js" ;
67 import { getContext } from " svelte" ;
1314 };
1415
1516 $ : cssVarStyles = getStyles (" 0" );
17+
18+ // Spinning animation state for theme toggle
19+ let spinning = false ;
20+
21+ const toggleTheme = () => {
22+ spinning = true ;
23+ darkTheme .set (! $darkTheme );
24+ setTimeout (() => {
25+ spinning = false ;
26+ }, 500 );
27+ };
1628 </script >
1729
1830<nav
@@ -31,17 +43,15 @@ dark:border-zinc-700 border-zinc-200"
3143 </div >
3244
3345 <div id =" right" class =" sm:space-x-6 space-x-4 flex items-center" >
34- <button
35- on:click ={() => ($darkTheme = ! $darkTheme )}
36- class =" btn-circ" >
46+ <button on:click ={toggleTheme } class =" btn-circ" >
3747 {#if $darkTheme }
3848 <svg
3949 xmlns =" http://www.w3.org/2000/svg"
4050 fill =" none"
4151 viewBox =" 0 0 24 24"
4252 stroke-width =" 1.5"
4353 stroke =" currentColor"
44- class =" btn-icon" >
54+ class ="btn-icon { spinning ? ' spin ' : ' ' } " >
4555 <path
4656 stroke-linecap =" round"
4757 stroke-linejoin =" round"
@@ -54,7 +64,7 @@ dark:border-zinc-700 border-zinc-200"
5464 viewBox =" 0 0 24 24"
5565 stroke-width =" 1.5"
5666 stroke =" currentColor"
57- class =" btn-icon" >
67+ class ="btn-icon { spinning ? ' spin ' : ' ' } " >
5868 <path
5969 stroke-linecap =" round"
6070 stroke-linejoin =" round"
@@ -63,7 +73,7 @@ dark:border-zinc-700 border-zinc-200"
6373 {/if }
6474 </button >
6575
66- <button class ="btn-circ" on:click ={() => modalStore . push (" theme" )}>
76+ <button class ="btn-circ" on:click ={() => panelStore . open (" theme" )}>
6777 <svg
6878 xmlns =" http://www.w3.org/2000/svg"
6979 fill =" none"
@@ -135,4 +145,17 @@ dark:border-zinc-700 border-zinc-200"
135145 .btn-icon {
136146 @apply w-5 h-5;
137147 }
148+
149+ .spin {
150+ animation : spin 0.5 s ease-in-out;
151+ }
152+
153+ @keyframes spin {
154+ from {
155+ transform : rotate (0 deg );
156+ }
157+ to {
158+ transform : rotate (360 deg );
159+ }
160+ }
138161 </style >
0 commit comments