@@ -5,6 +5,7 @@ import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
55
66import { useDispatch , useSelector } from "@/store" ;
77import { setIsDark , setTheme , setThemeMode } from "@/store/module/global" ;
8+ import "./index.less" ;
89
910type props = {
1011 open : boolean ;
@@ -33,36 +34,37 @@ const ThemeComp = (props: props) => {
3334 setColorHex ( "#a855f7" ) ;
3435 } ;
3536
36- const { themeMode } = useSelector ( state => state . global ) ;
37+ const { themeMode, isDark } = useSelector ( state => state . global ) ;
3738 const changeTheme = ( checked : boolean , mode : "" | "gray" | "week" ) => {
3839 checked ? dispatch ( setThemeMode ( mode ) ) : dispatch ( setThemeMode ( "" ) ) ;
3940 } ;
4041
4142 return (
4243 < >
43- < Drawer title = "主题配置🎨" placement = "right" onClose = { onClose } open = { open } >
44+ < Drawer className = "theme" title = "主题配置🎨" placement = "right" onClose = { onClose } open = { open } >
4445 < div className = "flx-justify-between" >
45- < p className = "base -color" > 主题颜色:</ p >
46+ < p className = "theme -color" > 主题颜色:</ p >
4647 < ColorPicker format = { formatHex } showText value = { themeVal } onFormatChange = { setFormatHex } onChange = { setColorHex } />
4748 </ div >
4849 < div className = "flx-justify-between" style = { { marginTop : "20px" } } >
49- < p className = "base -color" > 重置主题:</ p >
50+ < p className = "theme -color" > 重置主题:</ p >
5051 < Button type = "primary" style = { { backgroundColor : "#a855f7" } } onClick = { resetTheme } >
5152 重置
5253 </ Button >
5354 </ div >
5455 < div className = "flx-justify-between" style = { { marginTop : "20px" } } >
55- < p className = "base -color" > 暗黑模式:</ p >
56+ < p className = "theme -color" > 暗黑模式:</ p >
5657 < Switch
5758 checkedChildren = { < > 🌞</ > }
5859 unCheckedChildren = { < > 🌜</ > }
60+ defaultChecked = { isDark }
5961 onChange = { checked => {
6062 dispatch ( setIsDark ( checked ) ) ;
6163 } }
6264 />
6365 </ div >
6466 < div className = "flx-justify-between" style = { { marginTop : "20px" } } >
65- < p className = "base -color" > 灰色模式:</ p >
67+ < p className = "theme -color" > 灰色模式:</ p >
6668 < Switch
6769 checkedChildren = { < CheckOutlined /> }
6870 unCheckedChildren = { < CloseOutlined /> }
@@ -71,7 +73,7 @@ const ThemeComp = (props: props) => {
7173 />
7274 </ div >
7375 < div className = "flx-justify-between" style = { { marginTop : "20px" } } >
74- < p className = "base -color" > 色弱模式:</ p >
76+ < p className = "theme -color" > 色弱模式:</ p >
7577 < Switch
7678 checkedChildren = { < CheckOutlined /> }
7779 unCheckedChildren = { < CloseOutlined /> }
0 commit comments