Skip to content

Commit 600140d

Browse files
committed
feat: toggle ui theme in settings
1 parent 275bf36 commit 600140d

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

electron/renderer/components/sidebar/settings/sidebar-item-settings.tsx

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
1-
import { EuiCallOut, EuiPanel, EuiSpacer } from '@elastic/eui';
1+
import type { EuiThemeColorMode } from '@elastic/eui';
2+
import {
3+
EuiCallOut,
4+
EuiForm,
5+
EuiFormRow,
6+
EuiPanel,
7+
EuiRadioGroup,
8+
EuiSpacer,
9+
} from '@elastic/eui';
210
import type { ReactNode } from 'react';
11+
import { useTheme } from '../../../hooks/theme.jsx';
312

413
export const SidebarItemSettings: React.FC = (): ReactNode => {
14+
const { colorMode, setColorMode } = useTheme();
15+
516
return (
617
<EuiPanel>
718
<EuiCallOut title="Settings" iconType="gear" size="s">
8-
(todo)
19+
Customize your Phoenix experience.
920
</EuiCallOut>
1021

1122
<EuiSpacer size="m" />
23+
24+
<EuiForm component="form">
25+
<EuiFormRow label="Appearance">
26+
<EuiRadioGroup
27+
name="theme"
28+
idSelected={colorMode}
29+
options={[
30+
{
31+
id: 'light',
32+
label: 'Light',
33+
},
34+
{
35+
id: 'dark',
36+
label: 'Dark',
37+
},
38+
]}
39+
onChange={(themeId: string) => {
40+
setColorMode?.(themeId as EuiThemeColorMode);
41+
}}
42+
/>
43+
</EuiFormRow>
44+
</EuiForm>
1245
</EuiPanel>
1346
);
1447
};

0 commit comments

Comments
 (0)