Skip to content

Commit

Permalink
fix(config): options are not getting reflected in fav light/dark them…
Browse files Browse the repository at this point in the history
…e select, closes #1079
  • Loading branch information
kunish committed Oct 12, 2024
1 parent f2578c9 commit ae1158d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export const App: ParentComponent = ({ children }) => {
const prefersDark = usePrefersDark()

createEffect(() => {
console.log(
autoSwitchTheme(),
prefersDark(),
favNightTheme(),
favDayTheme(),
)

if (autoSwitchTheme())
setCurTheme(prefersDark() ? favNightTheme() : favDayTheme())
})
Expand Down
14 changes: 10 additions & 4 deletions src/pages/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,16 @@ const ConfigForXd = () => {
<ConfigTitle>{t('favDayTheme')}</ConfigTitle>

<Select
value={favDayTheme()}
onChange={(e) =>
setFavDayTheme(e.target.value as (typeof themes)[number])
}
>
<For each={themes}>
{(theme) => <option value={theme}>{theme}</option>}
{(theme) => (
<option selected={favDayTheme() === theme} value={theme}>
{theme}
</option>
)}
</For>
</Select>
</div>
Expand All @@ -507,13 +510,16 @@ const ConfigForXd = () => {
<ConfigTitle>{t('favNightTheme')}</ConfigTitle>

<Select
value={favNightTheme()}
onChange={(e) =>
setFavNightTheme(e.target.value as (typeof themes)[number])
}
>
<For each={themes}>
{(theme) => <option value={theme}>{theme}</option>}
{(theme) => (
<option selected={favNightTheme() === theme} value={theme}>
{theme}
</option>
)}
</For>
</Select>
</div>
Expand Down

0 comments on commit ae1158d

Please sign in to comment.