MSP-3074 add antd theme
This commit is contained in:
1 parent
9f7fa17af1
commit
5f73d33a58
6 files changed
+984
-49
No files matched your search
@@ -20,6 +20,8 @@
|
|||||||
"react-router-dom": "^6.22.3"
|
"react-router-dom": "^6.22.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"antd-style": "3.6.2-beta.1",
|
||||||
|
"antd": "5.15.3",
|
||||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||||
"@types/node": "^20.11.24",
|
"@types/node": "^20.11.24",
|
||||||
"@types/react": "^18.2.56",
|
"@types/react": "^18.2.56",
|
||||||
|
|||||||
+16
-1
@@ -2,16 +2,31 @@ import { Route, Routes } from 'react-router-dom';
|
|||||||
import HomePages from '../pages/HomePage/HomePages.tsx';
|
import HomePages from '../pages/HomePage/HomePages.tsx';
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
|
|
||||||
function App() {
|
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() {
|
||||||
|
const [appearance, setTheme] = useState<ThemeAppearance>('light');
|
||||||
return (
|
return (
|
||||||
<div className="app">
|
<div className="app">
|
||||||
|
<Segmented onChange={(v) => setTheme(v as ThemeAppearance)} options={options} />
|
||||||
|
<ThemeProvider appearance={appearance} >
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<HomePages/>}/>
|
<Route path="/" element={<HomePages/>}/>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
</ThemeProvider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App
|
export default App
|
||||||
|
|
||||||
+4
-38
@@ -1,42 +1,8 @@
|
|||||||
#root {
|
#root {
|
||||||
max-width: 1280px;
|
width: 100%;
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
.app {
|
||||||
.logo {
|
min-height: 100vh;
|
||||||
height: 6em;
|
|
||||||
padding: 1.5em;
|
|
||||||
will-change: filter;
|
|
||||||
transition: filter 300ms;
|
|
||||||
}
|
|
||||||
.logo:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #646cffaa);
|
|
||||||
}
|
|
||||||
.logo.react:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes logo-spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: no-preference) {
|
|
||||||
a:nth-of-type(2) .logo {
|
|
||||||
animation: logo-spin infinite 20s linear;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
padding: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.read-the-docs {
|
|
||||||
color: #888;
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
import Layout from '../Layout/Layout.tsx';
|
||||||
function HomePages() {
|
function HomePages() {
|
||||||
return <div>HomePages</div>;
|
return <Layout />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default HomePages;
|
export default HomePages;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { App, Button } from 'antd';
|
||||||
|
import { useTheme } from 'antd-style';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Layout= () => {
|
||||||
|
const theme = useTheme();
|
||||||
|
return (
|
||||||
|
<App>
|
||||||
|
<div style={{
|
||||||
|
background: theme.colorBgLayout,
|
||||||
|
minHeight: '100vh'
|
||||||
|
}}>
|
||||||
|
<Button ghost type={'primary'}>
|
||||||
|
Border
|
||||||
|
</Button>
|
||||||
|
<Button type={'primary'}>Primary</Button>
|
||||||
|
</div>
|
||||||
|
</App>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Layout;
|
||||||
Reference in new issue
Block a user