@@ -10,7 +10,8 @@ import {
1010 cn ,
1111} from '@qwik-ui/utils' ;
1212import { LuSlidersHorizontal , LuX } from '@qwikest/icons/lucide' ;
13- import { useTheme } from 'qwik-themes' ;
13+ import { useTheme } from '@qwik-ui/themes' ;
14+
1415import { Button , Modal , buttonVariants } from '~/components/ui' ;
1516
1617import { useAppState } from '~/_state/use-app-state' ;
@@ -19,10 +20,10 @@ import CopyCssConfig from '../copy-css-config/copy-css-config';
1920export default component$ < PropsOf < typeof Button > > ( ( ) => {
2021 const rootStore = useAppState ( ) ;
2122
22- const { theme , setTheme } = useTheme ( ) ;
23+ const { themeSig } = useTheme ( ) ;
2324
2425 const themeComputedObjectSig = useComputed$ ( ( ) : ThemeConfig => {
25- if ( ! theme || theme === 'light' ) {
26+ if ( ! themeSig . value || themeSig . value === 'light' ) {
2627 return {
2728 font : ThemeFonts . SANS ,
2829 mode : ThemeModes . LIGHT ,
@@ -33,7 +34,7 @@ export default component$<PropsOf<typeof Button>>(() => {
3334 } ;
3435 }
3536
36- if ( theme === 'dark' ) {
37+ if ( themeSig . value === 'dark' ) {
3738 return {
3839 font : ThemeFonts . SANS ,
3940 mode : ThemeModes . DARK ,
@@ -44,7 +45,9 @@ export default component$<PropsOf<typeof Button>>(() => {
4445 } ;
4546 }
4647
47- const themeArray = Array . isArray ( theme ) ? theme : theme . split ( ' ' ) ;
48+ const themeArray = Array . isArray ( themeSig . value )
49+ ? themeSig . value
50+ : themeSig . value . split ( ' ' ) ;
4851 return {
4952 font : themeArray [ 0 ] ,
5053 mode : themeArray [ 1 ] ,
@@ -91,7 +94,7 @@ export default component$<PropsOf<typeof Button>>(() => {
9194 themeComputedObjectSig . value . font = ThemeFonts . SANS ;
9295 }
9396 themeComputedObjectSig . value . style = el . value ;
94- setTheme ( await themeStoreToThemeClasses$ ( ) ) ;
97+ themeSig . value = await themeStoreToThemeClasses$ ( ) ;
9598 } }
9699 >
97100 < option value = { 'simple' } > Simple</ option >
@@ -114,7 +117,7 @@ export default component$<PropsOf<typeof Button>>(() => {
114117 onClick$ = { async ( ) => {
115118 themeComputedObjectSig . value . baseColor = baseColor ;
116119
117- setTheme ( await themeStoreToThemeClasses$ ( ) ) ;
120+ themeSig . value = await themeStoreToThemeClasses$ ( ) ;
118121 } }
119122 class = { cn (
120123 'flex h-3 w-3 items-center justify-center rounded-none' ,
@@ -165,7 +168,7 @@ export default component$<PropsOf<typeof Button>>(() => {
165168 size = "icon"
166169 onClick$ = { async ( ) => {
167170 themeComputedObjectSig . value . primaryColor = primaryColor ;
168- setTheme ( await themeStoreToThemeClasses$ ( ) ) ;
171+ themeSig . value = await themeStoreToThemeClasses$ ( ) ;
169172 } }
170173 class = { cn (
171174 'h-3 w-3 rounded-none' ,
@@ -182,7 +185,7 @@ export default component$<PropsOf<typeof Button>>(() => {
182185 primaryColor === 'primary-zinc-900' ||
183186 primaryColor === 'primary-neutral-900' ||
184187 primaryColor === 'primary-stone-900' ) &&
185- theme ?. includes ( 'dark' ) ? (
188+ themeSig . value ?. includes ( 'dark' ) ? (
186189 < span
187190 class = { cn (
188191 'flex h-[10px] w-[10px] shrink-0 rounded-none' ,
@@ -439,7 +442,7 @@ export default component$<PropsOf<typeof Button>>(() => {
439442 look = "outline"
440443 onClick$ = { async ( ) => {
441444 themeComputedObjectSig . value . borderRadius = borderRadius ;
442- setTheme ( await themeStoreToThemeClasses$ ( ) ) ;
445+ themeSig . value = await themeStoreToThemeClasses$ ( ) ;
443446 } }
444447 class = { cn ( 'w-12' , isActive && 'mb-2 border-ring' ) }
445448 >
@@ -462,7 +465,7 @@ export default component$<PropsOf<typeof Button>>(() => {
462465 themeComputedObjectSig . value . mode =
463466 themeComputedObjectSig . value . mode ?. includes ( 'light' ) ? 'dark' : 'light' ;
464467
465- setTheme ( await themeStoreToThemeClasses$ ( ) ) ;
468+ themeSig . value = await themeStoreToThemeClasses$ ( ) ;
466469 } }
467470 />
468471 </ div >
@@ -471,7 +474,9 @@ export default component$<PropsOf<typeof Button>>(() => {
471474 < footer class = " flex w-full justify-between gap-4" >
472475 < Button
473476 look = "ghost"
474- onClick$ = { ( ) => setTheme ( theme ?. includes ( 'dark' ) ? 'dark' : 'light' ) }
477+ onClick$ = { ( ) => {
478+ themeSig . value = themeSig . value ?. includes ( 'dark' ) ? 'dark' : 'light' ;
479+ } }
475480 >
476481 Reset
477482 </ Button >
0 commit comments