mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2024-11-17 06:39:25 +08:00
Added sidebar
This commit is contained in:
parent
17ea11a29c
commit
534993efc2
7 changed files with 98 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Dashboard from "./Routes/Dashboard/Dashboard";
|
import Dashboard from "./Routes/Dashboard/Dashboard";
|
||||||
import Header from "./Components/Header/Header";
|
import Header from "./Components/Header/Header";
|
||||||
|
import Container from "./Components/Container/Container";
|
||||||
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
||||||
import Store from "./Plugins/Redux/Store/Store";
|
import Store from "./Plugins/Redux/Store/Store";
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
|
@ -17,7 +18,9 @@ export default function App() {
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<Provider store={Store}>
|
<Provider store={Store}>
|
||||||
<Header />
|
<Header />
|
||||||
<RouterProvider router={router} />
|
<Container>
|
||||||
|
<RouterProvider router={router} />
|
||||||
|
</Container>
|
||||||
</Provider>
|
</Provider>
|
||||||
</React.StrictMode>
|
</React.StrictMode>
|
||||||
);
|
);
|
||||||
|
|
21
src/components/Container/Container.tsx
Normal file
21
src/components/Container/Container.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import React from "react";
|
||||||
|
import Sidebar from "../Sidebar/Sidebar";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Container(props: props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div style={{ display: "flex", flexDirection: "row" }}>
|
||||||
|
<div style={{ width: "85%", position: "fixed", left: "15%" }}>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
<div style={{ width: "15%", position: "fixed" }}>
|
||||||
|
<Sidebar />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import styles from "../../styles";
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
return (
|
return (
|
||||||
<div style={styles.header_container}>
|
<div style={styles.header_wrapper}>
|
||||||
<div style={styles.header_left}>
|
<div style={styles.header_left}>
|
||||||
<AppLogo size={64} color="#6f9b78" />
|
<AppLogo size={64} color="#6f9b78" />
|
||||||
<p style={styles.logo_title}>Ivy</p>
|
<p style={styles.logo_title}>Ivy</p>
|
||||||
|
|
|
@ -33,14 +33,7 @@ export default function Login() {
|
||||||
onClick={login}
|
onClick={login}
|
||||||
value="Login"
|
value="Login"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
style={{
|
style={styles.login_button}
|
||||||
backgroundColor: "#9e8500",
|
|
||||||
width: 128,
|
|
||||||
height: 32,
|
|
||||||
border: "none",
|
|
||||||
padding: 8,
|
|
||||||
borderRadius: 16,
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<p style={styles.text}>Login</p>
|
<p style={styles.text}>Login</p>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
20
src/components/Sidebar/Sidebar.tsx
Normal file
20
src/components/Sidebar/Sidebar.tsx
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import React from "react";
|
||||||
|
import styles from "../../styles";
|
||||||
|
import SidebarButton from "../SidebarButton/SidebarButton";
|
||||||
|
export interface state {
|
||||||
|
minimized: {
|
||||||
|
value: boolean;
|
||||||
|
sidebar_width: string;
|
||||||
|
page_width: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export default function Sidebar() {
|
||||||
|
return (
|
||||||
|
<div style={styles.sidebar_wrapper}>
|
||||||
|
<SidebarButton onClick={() => console.log("WIP!")} name="Dashboard" />
|
||||||
|
<SidebarButton onClick={() => console.log("WIP!")} name="Products" />
|
||||||
|
<SidebarButton onClick={() => console.log("WIP!")} name="Inventory" />
|
||||||
|
<SidebarButton onClick={() => console.log("WIP!")} name="Logs" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
21
src/components/SidebarButton/SidebarButton.tsx
Normal file
21
src/components/SidebarButton/SidebarButton.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import React from "react";
|
||||||
|
import { Button } from "@mui/material";
|
||||||
|
import styles from "../../styles";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
name: string;
|
||||||
|
onClick: any;
|
||||||
|
}
|
||||||
|
export default function SidebarButton(props: props) {
|
||||||
|
return (
|
||||||
|
<div style={{ display: "flex", paddingBottom: 16 }}>
|
||||||
|
<Button
|
||||||
|
onClick={props.onClick}
|
||||||
|
variant="contained"
|
||||||
|
style={styles.sidebar_button}
|
||||||
|
>
|
||||||
|
<p style={styles.text}>{props.name}</p>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -22,12 +22,12 @@ const styles: { [key: string]: React.CSSProperties } = {
|
||||||
fontSize: 26,
|
fontSize: 26,
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
},
|
},
|
||||||
header_container: {
|
header_wrapper: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
position: "sticky",
|
position: "sticky",
|
||||||
backgroundColor: "#3d4848",
|
|
||||||
top: 0,
|
top: 0,
|
||||||
|
backgroundColor: "#3d4848",
|
||||||
paddingRight: 32,
|
paddingRight: 32,
|
||||||
paddingLeft: 32,
|
paddingLeft: 32,
|
||||||
},
|
},
|
||||||
|
@ -37,6 +37,7 @@ const styles: { [key: string]: React.CSSProperties } = {
|
||||||
width: "50%",
|
width: "50%",
|
||||||
justifyContent: "left",
|
justifyContent: "left",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
paddingLeft: 16,
|
||||||
},
|
},
|
||||||
header_right: {
|
header_right: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -45,6 +46,33 @@ const styles: { [key: string]: React.CSSProperties } = {
|
||||||
justifyContent: "right",
|
justifyContent: "right",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
},
|
},
|
||||||
|
login_button: {
|
||||||
|
backgroundColor: "#9e8500",
|
||||||
|
width: 128,
|
||||||
|
height: 32,
|
||||||
|
border: "none",
|
||||||
|
padding: 8,
|
||||||
|
borderRadius: 16,
|
||||||
|
},
|
||||||
|
sidebar_button: {
|
||||||
|
backgroundColor: "#0b2322",
|
||||||
|
width: 256,
|
||||||
|
height: 64,
|
||||||
|
border: "none",
|
||||||
|
padding: 8,
|
||||||
|
borderTopLeftRadius: 32,
|
||||||
|
borderBottomLeftRadius: 32,
|
||||||
|
borderTopRightRadius: 0,
|
||||||
|
borderBottomRightRadius: 0,
|
||||||
|
},
|
||||||
|
sidebar_wrapper: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
height: "100vh",
|
||||||
|
width: "100%",
|
||||||
|
backgroundColor: "#3d4848",
|
||||||
|
alignItems: "flex-end",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default styles;
|
export default styles;
|
||||||
|
|
Loading…
Reference in a new issue