File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
packages/svelte-ux/src/lib/components Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " svelte-ux " : patch
3+ ---
4+
5+ Fix ThemeSwitch SSR behavior by using ` dark ` class to define positioning and icon display
Original file line number Diff line number Diff line change 1515 let newTheme = e .target ?.checked ? ' dark' : ' light' ;
1616 currentTheme .setTheme (newTheme );
1717 }}
18- let:checked
18+ classes ={{
19+ switch : ' dark:bg-primary dark:border-primary' ,
20+ toggle : ' translate-x-0 dark:translate-x-full' ,
21+ }}
1922 {...$$restProps }
2023>
21- {#if checked }
22- <Icon data ={mdiWeatherNight } size =" .8rem" class =" text-primary" />
23- {:else }
24- <Icon data ={mdiWhiteBalanceSunny } size =" .8rem" class =" text-primary" />
25- {/if }
24+ <div class =" grid grid-cols-1 grid-rows-1" >
25+ <Icon
26+ data ={mdiWeatherNight }
27+ size =" .8rem"
28+ class =" row-[1] col-[1] text-primary opacity-0 dark:opacity-100"
29+ />
30+ <Icon
31+ data ={mdiWhiteBalanceSunny }
32+ size =" .8rem"
33+ class =" row-[1] col-[1] text-primary opacity-100 dark:opacity-0"
34+ />
35+ </div >
2636</Switch >
You can’t perform that action at this time.
0 commit comments