'first'
This commit is contained in:
26
src/components/ThemeWrapper/index.tsx
Normal file
26
src/components/ThemeWrapper/index.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { ConfigProvider, Layout, type LayoutProps, theme } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
const { Content } = Layout;
|
||||
|
||||
/** * ThemeWrapper component that wraps the application with Ant Design's ConfigProvider to apply the selected theme
|
||||
* @param children - The content to be wrapped by the theme provider
|
||||
*/
|
||||
const ThemeWrapper: React.FC<LayoutProps> = ({ children, ...restProps }) => {
|
||||
const localTheme = localStorage.getItem('navTheme');
|
||||
return (
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
algorithm:
|
||||
localTheme === 'realDark'
|
||||
? theme.darkAlgorithm
|
||||
: theme.defaultAlgorithm,
|
||||
}}
|
||||
>
|
||||
<Layout>
|
||||
<Content {...restProps}>{children}</Content>
|
||||
</Layout>
|
||||
</ConfigProvider>
|
||||
);
|
||||
};
|
||||
export default ThemeWrapper;
|
||||
Reference in New Issue
Block a user