import { useState } from "react"; import { showDialog } from "./Dialog"; import MyAccountSection from "./MyAccountSection"; import PreferencesSection from "./PreferencesSection"; import "../less/setting-dialog.less"; interface Props extends DialogProps {} type SettingSection = "my-account" | "preferences"; interface State { selectedSection: SettingSection; } const SettingDialog: React.FC = (props: Props) => { const { destroy } = props; const [state, setState] = useState({ selectedSection: "my-account", }); const handleSectionSelectorItemClick = (settingSection: SettingSection) => { setState({ selectedSection: settingSection, }); }; return (
handleSectionSelectorItemClick("my-account")} className={`section-item ${state.selectedSection === "my-account" ? "selected" : ""}`} > My account handleSectionSelectorItemClick("preferences")} className={`section-item ${state.selectedSection === "preferences" ? "selected" : ""}`} > Preferences
{state.selectedSection === "my-account" ? ( ) : state.selectedSection === "preferences" ? ( ) : null}
); }; export default function showSettingDialog(): void { showDialog( { className: "setting-dialog", useAppContext: true, }, SettingDialog, {} ); }