Skip to content

Commit

Permalink
# improve theme
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 committed Mar 7, 2024
1 parent d3361a4 commit b7b5a9a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 35 deletions.
4 changes: 4 additions & 0 deletions src/assets/less/Home.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
margin: 0;
padding: 0;
}
9 changes: 5 additions & 4 deletions src/layout/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import {Layout} from 'antd';
import {useRoutes} from "react-router-dom";
import routes from "@/route";

const AntdContent = Layout.Content;

const Content: React.FC = () => {
return (
<AntdContent>
<Layout.Content
style={{
paddingBlock:"8px",
}}>
{useRoutes(routes)}
</AntdContent>
</Layout.Content>
)
}

Expand Down
13 changes: 13 additions & 0 deletions src/layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import {Layout} from "antd";


const Footer: React.FC = () => {
return (
<Layout.Footer style={{textAlign: 'center'}}>
Ant Design ©{new Date().getFullYear()} Created by Ant UED
</Layout.Footer>
);
}

export default Footer
51 changes: 27 additions & 24 deletions src/layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";

import { Layout, Menu } from 'antd';
import { Link } from "react-router-dom";
import menus, { MenuModel } from "@/menu";
import {Layout, Menu} from 'antd';
import {Link} from "react-router-dom";
import menus, {MenuModel} from "@/menu";


function recursiveMenu(menus: MenuModel[], parentKey?: string) {
Expand All @@ -27,29 +27,32 @@ function recursiveMenu(menus: MenuModel[], parentKey?: string) {
<Menu.Item key={key}>
{t.icon}
<span>{t.name}</span>
{t.path && <Link to={t.path} target={t.redirect ? "_blank" : ""} />}
{t.path && <Link to={t.path} target={t.redirect ? "_blank" : ""}/>}
</Menu.Item>
)
})
}

export default class Header extends React.Component<any, any> {
render() {
return (
<Layout.Header
style={{
position: 'sticky',
top: 0,
zIndex: 1,
width: '100%',
display: 'flex',
alignItems: 'center',
}}
>
<Menu mode="horizontal" theme="dark">
{recursiveMenu(menus)}
</Menu>
</Layout.Header>
)
}
}
const Header: React.FC = () => {
return (
<Layout.Header
style={{
position: 'sticky',
top: 0,
zIndex: 1,
width: '100%',
display: 'flex',
alignItems: 'center',
background: "#ffffff",
}}
>
<Menu theme={"light"} mode="horizontal"
style={{
flex: 1, minWidth: 0,
}}>
{recursiveMenu(menus)}
</Menu>
</Layout.Header>
)
}
export default Header
15 changes: 8 additions & 7 deletions src/layout/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import '@/assets/less/Home.less'
import React from "react";
import {Layout} from 'antd';
import Header from '@/layout/Header'
import Content from '@/layout/Content'
import Footer from '@/layout/Footer'

const Home: React.FC<any> = (props: any) => {
const Home: React.FC = () => {
return (
<Layout>
<Header/>
<Layout className={"container"}>
<Content/>
</Layout>
</Layout>
<Layout>
<Header/>
<Content/>
<Footer/>
</Layout>
);
}
export default Home

0 comments on commit b7b5a9a

Please sign in to comment.