2021-02-22 02:39:04 +00:00
|
|
|
import { Component } from "inferno";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Helmet } from "inferno-helmet";
|
2021-08-20 02:56:18 +00:00
|
|
|
import { MyUserInfo } from "lemmy-js-client";
|
2020-10-26 14:28:17 +00:00
|
|
|
|
2020-10-26 18:42:07 +00:00
|
|
|
interface Props {
|
2021-08-20 02:56:18 +00:00
|
|
|
myUserInfo: MyUserInfo | undefined;
|
2020-10-26 18:42:07 +00:00
|
|
|
}
|
2020-10-26 14:28:17 +00:00
|
|
|
|
2020-10-26 18:42:07 +00:00
|
|
|
export class Theme extends Component<Props> {
|
|
|
|
render() {
|
2021-08-20 02:56:18 +00:00
|
|
|
let user = this.props.myUserInfo;
|
|
|
|
let hasTheme = user && user.local_user_view.local_user.theme !== "browser";
|
2020-10-26 18:42:07 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Helmet>
|
2021-03-15 18:09:31 +00:00
|
|
|
{hasTheme ? (
|
2020-10-27 00:52:50 +00:00
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
|
|
|
type="text/css"
|
2021-08-20 02:56:18 +00:00
|
|
|
href={`/static/assets/css/themes/${user.local_user_view.local_user.theme}.min.css`}
|
2020-10-27 00:52:50 +00:00
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
[
|
2020-10-26 18:42:07 +00:00
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
|
|
|
type="text/css"
|
|
|
|
href="/static/assets/css/themes/litely.min.css"
|
|
|
|
id="default-light"
|
|
|
|
media="(prefers-color-scheme: light)"
|
2020-10-27 00:52:50 +00:00
|
|
|
/>,
|
2020-10-26 18:42:07 +00:00
|
|
|
<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)"
|
2020-10-27 00:52:50 +00:00
|
|
|
/>,
|
|
|
|
]
|
2020-10-26 18:42:07 +00:00
|
|
|
)}
|
|
|
|
</Helmet>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|