| | |
| | | // ProLayout 支持的api https://procomponents.ant.design/components/layout |
| | | // 优先级 layout > config > defaultSetting |
| | | export const layout = ({ initialState, setInitialState }) => { |
| | | const [darkMode, setDarkMode] = React.useState(() => { |
| | | return JSON.parse(localStorage.getItem('darkMode')) || false; |
| | | }); |
| | | |
| | | React.useEffect(() => { |
| | | localStorage.setItem('darkMode', JSON.stringify(darkMode)); |
| | | }, [darkMode]); |
| | | |
| | | return { |
| | | actionsRender: () => [<Brightness />, <Question key="doc" />, <SelectLang key="SelectLang" />], |
| | | actionsRender: () => [ |
| | | <Brightness darkMode={darkMode} setDarkMode={setDarkMode} />, |
| | | // <Question key="doc" />, |
| | | // <SelectLang key="SelectLang" /> |
| | | ], |
| | | avatarProps: { |
| | | src: initialState?.currentUser?.avatar, |
| | | title: <AvatarName />, |
| | |
| | | fixSiderbar: true, // 固定导航 |
| | | // settings: defaultSettings, // layout 的设置 |
| | | // waterMarkProps: { content: initialState?.currentUser?.nickname }, //水印 |
| | | navTheme: 'realDark', // 默认主题颜色 "realDark" | "light" | undef... |
| | | // navTheme: 'realDark', // 默认主题颜色 "realDark" | "light" | undef... |
| | | navTheme: darkMode ? 'realDark' : 'light', |
| | | footerRender: false, // 页脚 启用请注释,不是设置为true |
| | | }; |
| | | }; |
File was renamed from zy-asrs-flow/src/components/RightContent/index.tsx |
| | |
| | | import React from 'react'; |
| | | import { MoonOutlined, BulbOutlined } from '@ant-design/icons'; |
| | | |
| | | export type SiderTheme = 'light' | 'dark'; |
| | | |
| | | export const SelectLang = () => { |
| | | return ( |
| | | <UmiSelectLang |
| | |
| | | ); |
| | | }; |
| | | |
| | | export const Brightness = () => { |
| | | export const Brightness = ({ darkMode, setDarkMode }) => { |
| | | const handleClick = () => { |
| | | setDarkMode(!darkMode); |
| | | }; |
| | | return ( |
| | | <> |
| | | <div |
| | | style={{ |
| | | display: 'flex', |
| | | height: 26, |
| | | }} |
| | | onClick={() => { |
| | | window.open('https://pro.ant.design/docs/getting-started'); |
| | | }} |
| | | > |
| | | {/* <BulbOutlined /> */} |
| | | <MoonOutlined /> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | <div |
| | | style={{ |
| | | display: 'flex', |
| | | height: 26, |
| | | }} |
| | | onClick={handleClick} |
| | | > |
| | | {darkMode ? <BulbOutlined /> : <MoonOutlined />} |
| | | </div> |
| | | ); |
| | | }; |
| | |
| | | "@@test/*": ["./src/.umi-test/*"] |
| | | } |
| | | }, |
| | | "include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx", "src/app.tsx", "src/utils/icon-util.js", "src/pages/User/Login/index1.jsx", "src/components/Footer/index.jsx", "src/components/HeaderDropdown/index.jsx", "src/pages/system/host/components/UpdateForm.jsx", "src/pages/system/host/index.jsx", "src/utils/tree-util.js"] |
| | | "include": ["./**/*.d.ts", "./**/*.ts", "./**/*.tsx", "src/app.tsx", "src/utils/icon-util.js", "src/pages/User/Login/index1.jsx", "src/components/Footer/index.jsx", "src/components/HeaderDropdown/index.jsx", "src/pages/system/host/components/UpdateForm.jsx", "src/pages/system/host/index.jsx", "src/utils/tree-util.js", "src/components/RightContent/index.jsx"] |
| | | } |