MSP-3074 add layout
This commit is contained in:
1 parent
5f73d33a58
commit
92fcb4a352
7 files changed
+86
-34
No files matched your search
+15
-12
@@ -1,32 +1,35 @@
|
||||
import { useState } from 'react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import {App} from 'antd';
|
||||
import { ThemeAppearance, ThemeProvider } from 'antd-style';
|
||||
import Layout from "../pages/Layout/Layout.tsx";
|
||||
import HomePages from '../pages/HomePage/HomePages.tsx';
|
||||
import {Context} from "../store";
|
||||
import './app.scss'
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Segmented } from 'antd';
|
||||
import { ThemeAppearance, ThemeProvider } from 'antd-style';
|
||||
|
||||
|
||||
|
||||
const options = [
|
||||
{ label: 'Light', value: 'light' },
|
||||
{ label: 'Dark', value: 'dark' },
|
||||
];
|
||||
|
||||
function App() {
|
||||
function AppDefault() {
|
||||
const [appearance, setTheme] = useState<ThemeAppearance>('light');
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<Segmented onChange={(v) => setTheme(v as ThemeAppearance)} options={options} />
|
||||
<Context.Provider value={{setTheme}}>
|
||||
<ThemeProvider appearance={appearance} >
|
||||
<App>
|
||||
<Routes>
|
||||
<Route path="/" element={<HomePages/>}/>
|
||||
<Route path="/" element={<Layout />}>
|
||||
<Route index element={<HomePages/>}/>
|
||||
</Route>
|
||||
</Routes>
|
||||
</App>
|
||||
</ThemeProvider>
|
||||
</Context.Provider>
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
export default AppDefault
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import {useContext} from "react";
|
||||
import {ThemeAppearance, useTheme} from "antd-style";
|
||||
import {Segmented} from "antd";
|
||||
import {Context} from "../../store";
|
||||
|
||||
|
||||
const options = [
|
||||
{ label: 'Light', value: 'light' },
|
||||
{ label: 'Dark', value: 'dark' },
|
||||
];
|
||||
function Header() {
|
||||
const theme = useTheme();
|
||||
const { setTheme } = useContext(Context)
|
||||
return <header style={{
|
||||
background: theme.colorBgLayout,
|
||||
width: '100%',
|
||||
border: 'none',
|
||||
display: 'flex',
|
||||
justifyContent: 'end'
|
||||
}}><Segmented onChange={(v) => setTheme(v as ThemeAppearance)} options={options} /></header>;
|
||||
}
|
||||
|
||||
export default Header;
|
||||
@@ -0,0 +1,25 @@
|
||||
import {Button} from 'antd';
|
||||
import {useTheme} from 'antd-style';
|
||||
|
||||
|
||||
|
||||
const Main= () => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
background: theme.colorBgLayout,
|
||||
minHeight: '100vh',
|
||||
display: 'flex',
|
||||
justifyContent: 'center'
|
||||
}}>
|
||||
|
||||
<Button ghost type={'primary'}>
|
||||
Border
|
||||
</Button>
|
||||
<div>Проверка шрифтов</div>
|
||||
<Button type={'primary'}>Primary</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default Main;
|
||||
Reference in new issue
Block a user