mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-01 18:19:55 +00:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { UserSafeSettings } from 'lemmy-js-client';
|
|
import { Helmet } from 'inferno-helmet';
|
|
import { Component } from 'inferno';
|
|
|
|
interface Props {
|
|
user: UserSafeSettings | undefined;
|
|
}
|
|
|
|
export class Theme extends Component<Props> {
|
|
render() {
|
|
const { user } = this.props;
|
|
const hasUserTheme = user && user.theme !== 'browser';
|
|
|
|
return (
|
|
<Helmet>
|
|
{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>
|
|
);
|
|
}
|
|
}
|