-
-
Notifications
You must be signed in to change notification settings - Fork 47k
/
index.tsx
36 lines (32 loc) · 868 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { ThemeEditor } from 'antd-token-previewer';
import { useContext } from 'react';
import ThemeContext from '../../theme/slots/ThemeContext';
import useLocale from '../../hooks/useLocale';
import { ConfigProvider } from 'antd';
const locales = {
cn: {
title: '主题编辑器',
},
en: {
title: 'Theme Editor',
},
};
const CustomTheme = () => {
const [locale] = useLocale(locales);
const { setTheme, theme } = useContext(ThemeContext);
return (
<div>
<ConfigProvider theme={{ algorithm: undefined }}>
<ThemeEditor
theme={{ name: 'test', key: 'test', config: theme }}
simple
style={{ height: 'calc(100vh - 64px)' }}
onThemeChange={(newTheme) => {
setTheme(newTheme.config);
}}
/>
</ConfigProvider>
</div>
);
};
export default CustomTheme;