Skip to content

Commit

Permalink
[fix](@svelteui/core): fix dark-theme class inconsistency (#368)
Browse files Browse the repository at this point in the history
* [fix](@svelteui/core): fix \`dark-theme\` class inconsistency

* [fix](@svelteui/core): change currentTheme to be a regular variable
  • Loading branch information
longnguyen2004 authored May 13, 2023
1 parent 2fce98d commit 4b04313
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@
const useStyles = createStyles(() => ({ root: {} }));
const forwardEvents = createEventForwarder(get_current_component());
const DEFAULT_THEME = useSvelteUITheme();
const currentTheme = () => {
if (themeObserver === null) return null;
return themeObserver === 'light' ? (mergedTheme as unknown as string) : (dark as string);
};
let currentTheme: string | null = null;
$: {
if (themeObserver !== null)
{
currentTheme = themeObserver === 'light' ? (mergedTheme as unknown as string) : (dark as string);
}
}
$: if (withGlobalStyles) SvelteUIGlobalCSS();
$: if (withNormalizeCSS) NormalizeCSS();
Expand All @@ -63,7 +67,7 @@
bind:this={element}
use:useActions={use}
use:forwardEvents
class={cx(className, classes.root, currentTheme())}
class={cx(className, classes.root, currentTheme)}
{...$$restProps}
>
<slot />
Expand Down

0 comments on commit 4b04313

Please sign in to comment.