左侧栏初步

This commit is contained in:
禺狨 2023-03-02 14:25:18 +08:00
parent a856fb83c4
commit 569d478e15
12 changed files with 102 additions and 64 deletions

View File

@ -1,3 +1,3 @@
.App { .App {
background-color: #f6f6f6; background-color: #f6f6f6;
} }

View File

@ -4,8 +4,12 @@ import { useRoutes } from "react-router-dom";
import routes from "./router/routes"; import routes from "./router/routes";
function App() { function App() {
const element = useRoutes(routes); const Views = () => useRoutes(routes);
return <div className={styles.App}>{element}</div>; return (
<div className={styles.App}>
<Views />
</div>
);
} }
export default App; export default App;

View File

@ -1,46 +1,31 @@
.app-header { .app-header {
background-color: white !important; background-color: white !important;
} }
.main-menu {
padding-left: 6% !important; .main-header {
padding-right: 6% !important; width: 100%;
background-color: #1976d2 !important; background-color: white !important;
color: #f5f5f5 !important; height: 48px;
} line-height: 48px;
display: flex;
.button-group { align-items: center;
float: right; justify-content: space-between;
} }
.main-header { .App-logo {
width: 1200px; width: 151px;
background-color: white !important; height: 40px;
height: 70px; float: left;
line-height: 70px; }
width: 1200px;
margin-left: auto; .top-main {
margin-right: auto; display: flex;
display: flex; align-items: center;
align-items: center; }
justify-content: space-between;
} .title {
line-height: 64px !important;
.App-logo { display: inline;
width: 151px; color: #03a9f4 !important;
height: 40px; }
float: left;
}
.top-main {
display: flex;
align-items: center;
}
.title {
line-height: 64px !important;
display: inline;
color: #03a9f4 !important;
}

View File

@ -9,4 +9,5 @@
height: 40px; height: 40px;
margin-top: 16px; margin-top: 16px;
margin-left: 38px; margin-left: 38px;
margin-bottom: 20px;
} }

View File

@ -9,6 +9,7 @@ import { Menu } from "antd";
import { useNavigate, Link } from "react-router-dom"; import { useNavigate, Link } from "react-router-dom";
import styles from "./LeftMenu.module.css"; import styles from "./LeftMenu.module.css";
import logo from "../../assets/logo.png"; import logo from "../../assets/logo.png";
import "../../utils/index.css";
function getItem(label: any, key: any, icon: any, children: any, type: any) { function getItem(label: any, key: any, icon: any, children: any, type: any) {
return { return {
@ -21,7 +22,7 @@ function getItem(label: any, key: any, icon: any, children: any, type: any) {
} }
const items = [ const items = [
getItem("首页概览", "/", <SettingOutlined />, null, null), getItem("首页概览", "/", <SettingOutlined />, null, null),
getItem("网校装修", "/", <SettingOutlined />, null, null), getItem("网校装修", "/decoration", <SettingOutlined />, null, null),
getItem( getItem(
"课程内容", "课程内容",
"2", "2",
@ -61,10 +62,7 @@ export const LeftMenu: React.FC = () => {
}; };
return ( return (
<div className={styles["left-menu"]}> <div className={styles["left-menu"]}>
<Link <Link style={{ textDecoration: "none" }} to={`/`}>
style={{ textDecoration: "none" }}
to={`/`}
>
<img src={logo} alt="" className={styles["App-logo"]} /> <img src={logo} alt="" className={styles["App-logo"]} />
</Link> </Link>
<Menu <Menu

View File

View File

@ -0,0 +1,10 @@
import React from "react";
import styles from "./Dashboard.module.css";
export const Dashboard: React.FC<any> = () => {
return (
<div>
<p></p>
</div>
);
};

View File

@ -0,0 +1 @@
export * from "./Dashboard";

View File

@ -1,14 +1,6 @@
.page-content {
width: 1200px;
min-height: calc(100vh - 173px);
margin-left: auto;
margin-right: auto;
margin-top: 30px;
margin-bottom: 100px;
}
.layout-wrap { .layout-wrap {
width: 100%; width: 100%;
height: 100vh;
display: flex; display: flex;
} }
@ -21,3 +13,16 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.right-top {
width: 100%;
height: 48px;
}
.right-main {
flex: 1;
box-sizing: border-box;
padding: 24px;
overflow-y: auto;
background-color: #f1f2f9;
}

View File

@ -1,2 +1,3 @@
export * from "./home"; export * from "./home";
export * from "./login"; export * from "./login";
export * from "./dashboard";

View File

@ -1,11 +1,17 @@
import React from "react"; import React from "react";
import { RouteObject } from "react-router-dom"; import { RouteObject } from "react-router-dom";
import { Login, HomePage } from "../pages"; import { Login, HomePage, Dashboard } from "../pages";
const routes: RouteObject[] = [ const routes: RouteObject[] = [
{ {
path: "/", path: "/",
element: <HomePage />, element: <HomePage />,
children: [
{
path: "/",
element: <Dashboard />,
},
],
}, },
{ {
path: "/login", path: "/login",

27
src/utils/index.css Normal file
View File

@ -0,0 +1,27 @@
.ant-menu-item {
width: calc(100% - 32px) !important;
margin-left: 16px !important;
margin-right: 16px !important;
}
.ant-menu-submenu {
width: calc(100% - 24px) !important;
margin-left: 12px !important;
margin-right: 12px !important;
}
.ant-menu,
.ant-menu-sub,
.ant-menu-inline {
background-color: #ffffff !important;
}
.ant-menu-item-selected {
background-color: #ff4d4f !important;
color: white !important;
}
.ant-menu-item-active {
background-color: #ff4d4f !important;
color: white !important;
}