]> Untitled Git - lemmy-ui.git/commitdiff
Fixing an issue with browser theme.
authorDessalines <tyhou13@gmx.com>
Tue, 27 Oct 2020 00:52:50 +0000 (19:52 -0500)
committerDessalines <tyhou13@gmx.com>
Tue, 27 Oct 2020 00:52:50 +0000 (19:52 -0500)
src/shared/components/theme.tsx

index a1e0a01ff2e9a35ea14c2023d0a7d4e4c6822474..5dfc01cebb6b7beefd010d71809bc263002020f7 100644 (file)
@@ -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>
     );