Skip to content

Commit

Permalink
fix: adjust theme url for vite
Browse files Browse the repository at this point in the history
  • Loading branch information
OliwiaGowor committed Sep 27, 2024
1 parent 5a01b5d commit 6f42305
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/state/preferences/themeAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ function addLinkNode() {
}
type AddLinkEffect = () => AtomEffect<Theme>;
export const addLinkEffect: AddLinkEffect = () => ({ onSet, setSelf }) => {
const envUrl =
import.meta.env.BASE_URL === '/' ? '' : import.meta.env.BASE_URL;

setSelf(param => {
const defaultValue = param as Theme;
applyThemeToLinkNode(defaultValue, import.meta.env.BASE_URL);
applyThemeToLinkNode(defaultValue, envUrl);
return defaultValue;
});

Expand All @@ -65,7 +68,7 @@ export const addLinkEffect: AddLinkEffect = () => ({ onSet, setSelf }) => {
if (newTheme === 'light_dark')
themeNew = isSystemThemeDark() ? 'dark' : 'default';
else themeNew = newTheme === 'sap_horizon' ? 'default' : newTheme.slice(12);
applyThemeToLinkNode(themeNew, import.meta.env.BASE_URL);
applyThemeToLinkNode(themeNew, envUrl);
});
};

Expand Down

0 comments on commit 6f42305

Please sign in to comment.