Add setting option

This commit is contained in:
2022-05-20 14:41:52 +08:00
parent 4eb6637062
commit 70ff9fa0ad
5 changed files with 47 additions and 7 deletions
@@ -3,4 +3,6 @@
div.setting-popup {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 10px;
}
+37 -2
View File
@@ -2,8 +2,11 @@ import { Component, ReactNode } from "react";
import { Popup } from "@Context/Popups";
import { Theme } from "@Component/Theme/Theme";
import { Localization } from "@Component/Localization/Localization";
import { useSettingWithEvent, IMixinSettingProps, Themes } from "@Context/Setting";
import { ComboInput } from "@Input/ComboInput/ComboInput";
import "./SettingPopup.scss";
interface ISettingPopupProps {
}
@@ -24,10 +27,42 @@ class SettingPopup extends Popup<ISettingPopupProps> {
}
}
class SettingPopupComponent extends Component<ISettingPopupProps> {
@useSettingWithEvent("themes", "language")
class SettingPopupComponent extends Component<ISettingPopupProps & IMixinSettingProps> {
public render(): ReactNode {
return <Theme className="setting-popup"></Theme>
return <Theme className="setting-popup">
<ComboInput
keyI18n="Language"
allOption={[
{ key: "EN_US", i18n: "EN_US" },
{ key: "ZH_CN", i18n: "ZH_CN" }
]}
value={{
key: this.props.setting?.language ?? "EN_US",
i18n: this.props.setting?.language ?? "EN_US"
}}
valueChange={(data) => {
this.props.setting?.setProps("language", data.key as any);
}}
/>
<ComboInput
keyI18n="Themes"
allOption={[
{ key: Themes.dark as any, i18n: "Themes.Dark" },
{ key: Themes.light as any, i18n: "Themes.Light" }
]}
value={{
key: this.props.setting?.themes ?? Themes.dark as any,
i18n: this.props.setting?.themes === Themes.dark ? "Themes.Dark" : "Themes.Light"
}}
valueChange={(data) => {
this.props.setting?.setProps("themes", parseInt(data.key));
}}
/>
</Theme>
}
}