From dcb52b5c47d09f9a1a2b09e96c643374898c7313 Mon Sep 17 00:00:00 2001 From: Dessalines <tyhou13@gmx.com> Date: Mon, 26 Oct 2020 19:52:50 -0500 Subject: [PATCH] Fixing an issue with browser theme. --- src/shared/components/theme.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/shared/components/theme.tsx b/src/shared/components/theme.tsx index a1e0a01..5dfc01c 100644 --- a/src/shared/components/theme.tsx +++ b/src/shared/components/theme.tsx @@ -9,33 +9,33 @@ interface Props { export class Theme extends Component<Props> { render() { const { user } = this.props; - const userTheme = user && user.theme && ( - <link - rel="stylesheet" - type="text/css" - href={`/static/assets/css/themes/${user.theme}.min.css`} - /> - ); + const hasUserTheme = user && user.theme !== 'browser'; return ( <Helmet> - {userTheme ?? ( - <> + {hasUserTheme ? ( + <link + rel="stylesheet" + type="text/css" + href={`/static/assets/css/themes/${user.theme}.min.css`} + /> + ) : ( + [ <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/litely.min.css" id="default-light" media="(prefers-color-scheme: light)" - /> + />, <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="default-dark" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)" - /> - </> + />, + ] )} </Helmet> ); -- 2.44.1