Fixing an issue with browser theme.

This commit is contained in:
Dessalines 2020-10-26 19:52:50 -05:00
parent 397db2f1db
commit dcb52b5c47

View file

@ -9,33 +9,33 @@ interface Props {
export class Theme extends Component<Props> {
render() {
const { user } = this.props;
const userTheme = user && user.theme && (
const hasUserTheme = user && user.theme !== 'browser';
return (
<Helmet>
{hasUserTheme ? (
<link
rel="stylesheet"
type="text/css"
href={`/static/assets/css/themes/${user.theme}.min.css`}
/>
);
return (
<Helmet>
{userTheme ?? (
<>
) : (
[
<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>
);