mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2024-11-17 06:39:25 +08:00
Added icons to sidebar buttons and cleaned up code
This commit is contained in:
parent
c1c9444d33
commit
c7e3687544
9 changed files with 195 additions and 7 deletions
29
src/components/Icons/HomeIcon/HomeIcon.tsx
Normal file
29
src/components/Icons/HomeIcon/HomeIcon.tsx
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
size: number;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
export default function HomeIcon(props: props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="icon icon-tabler icon-tabler-home-2"
|
||||||
|
width={props.size}
|
||||||
|
height={props.size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke={props.color}
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M5 12l-2 0l9 -9l9 9l-2 0"></path>
|
||||||
|
<path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"></path>
|
||||||
|
<path d="M10 12h4v4h-4z"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
31
src/components/Icons/InventoryIcon/InventoryIcon.tsx
Normal file
31
src/components/Icons/InventoryIcon/InventoryIcon.tsx
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
size: number;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
export default function InventoryIcon(props: props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="icon icon-tabler icon-tabler-box-seam"
|
||||||
|
width={props.size}
|
||||||
|
height={props.size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke={props.color}
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M12 3l8 4.5v9l-8 4.5l-8 -4.5v-9l8 -4.5"></path>
|
||||||
|
<path d="M12 12l8 -4.5"></path>
|
||||||
|
<path d="M8.2 9.8l7.6 -4.6"></path>
|
||||||
|
<path d="M12 12v9"></path>
|
||||||
|
<path d="M12 12l-8 -4.5"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
28
src/components/Icons/LogoutIcon/LogoutIcon.tsx
Normal file
28
src/components/Icons/LogoutIcon/LogoutIcon.tsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
size: number;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
export default function LogoutIcon(props: props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="icon icon-tabler icon-tabler-logout"
|
||||||
|
width={props.size}
|
||||||
|
height={props.size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke={props.color}
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"></path>
|
||||||
|
<path d="M7 12h14l-3 -3m0 6l3 -3"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
32
src/components/Icons/LogsIcon/LogsIcon.tsx
Normal file
32
src/components/Icons/LogsIcon/LogsIcon.tsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
size: number;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
export default function LogsIcon(props: props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="icon icon-tabler icon-tabler-clipboard-data"
|
||||||
|
width={props.size}
|
||||||
|
height={props.size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke={props.color}
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"></path>
|
||||||
|
<path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"></path>
|
||||||
|
<path d="M9 17v-4"></path>
|
||||||
|
<path d="M12 17v-1"></path>
|
||||||
|
<path d="M15 17v-2"></path>
|
||||||
|
<path d="M12 17v-1"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
31
src/components/Icons/ProductsIcon/ProductsIcon.tsx
Normal file
31
src/components/Icons/ProductsIcon/ProductsIcon.tsx
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export interface props {
|
||||||
|
size: number;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
export default function ProductsIcon(props: props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
className="icon icon-tabler icon-tabler-list-numbers"
|
||||||
|
width={props.size}
|
||||||
|
height={props.size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke={props.color}
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
|
<path d="M11 6h9"></path>
|
||||||
|
<path d="M11 12h9"></path>
|
||||||
|
<path d="M12 18h8"></path>
|
||||||
|
<path d="M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"></path>
|
||||||
|
<path d="M6 10v-6l-2 2"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -9,7 +9,11 @@ export interface state {
|
||||||
value: boolean;
|
value: boolean;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export default function Logout() {
|
export interface props {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Logout(props: props) {
|
||||||
const logged_in = useSelector((state: state) => state.logged_in.value);
|
const logged_in = useSelector((state: state) => state.logged_in.value);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
@ -29,6 +33,7 @@ export default function Logout() {
|
||||||
variant="contained"
|
variant="contained"
|
||||||
style={styles.logout_button}
|
style={styles.logout_button}
|
||||||
>
|
>
|
||||||
|
{props.children}
|
||||||
<p style={styles.text}>Log Out</p>
|
<p style={styles.text}>Log Out</p>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import styles from "../../styles";
|
import styles from "../../styles";
|
||||||
import SidebarButton from "../SidebarButton/SidebarButton";
|
import SidebarButton from "../SidebarButton/SidebarButton";
|
||||||
|
import HomeIcon from "../Icons/HomeIcon/HomeIcon";
|
||||||
|
import ProductsIcon from "../Icons/ProductsIcon/ProductsIcon";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import Logout from "../Logout/Logout";
|
import Logout from "../Logout/Logout";
|
||||||
|
import InventoryIcon from "../Icons/InventoryIcon/InventoryIcon";
|
||||||
|
import LogsIcon from "../Icons/LogsIcon/LogsIcon";
|
||||||
|
import LogoutIcon from "../Icons/LogoutIcon/LogoutIcon";
|
||||||
export interface state {
|
export interface state {
|
||||||
minimized: {
|
minimized: {
|
||||||
value: boolean;
|
value: boolean;
|
||||||
|
@ -14,11 +19,30 @@ export default function Sidebar() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
return (
|
return (
|
||||||
<div style={styles.sidebar_wrapper}>
|
<div style={styles.sidebar_wrapper}>
|
||||||
<SidebarButton onClick={() => navigate("/")} name="Dashboard" />
|
<div
|
||||||
<SidebarButton onClick={() => navigate("/Products")} name="Products" />
|
style={{
|
||||||
<SidebarButton onClick={() => navigate("/Inventory")} name="Inventory" />
|
position: "relative",
|
||||||
<SidebarButton onClick={() => navigate("/Logs")} name="Logs" />
|
display: "flex",
|
||||||
<Logout />
|
flexDirection: "column",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SidebarButton onClick={() => navigate("/")} name="Dashboard">
|
||||||
|
<HomeIcon size={48} color="white" />
|
||||||
|
</SidebarButton>
|
||||||
|
<SidebarButton onClick={() => navigate("/Products")} name="Products">
|
||||||
|
<ProductsIcon size={48} color="white" />
|
||||||
|
</SidebarButton>
|
||||||
|
<SidebarButton onClick={() => navigate("/Inventory")} name="Inventory">
|
||||||
|
<InventoryIcon size={48} color="white" />
|
||||||
|
</SidebarButton>
|
||||||
|
<SidebarButton onClick={() => navigate("/Logs")} name="Logs">
|
||||||
|
<LogsIcon size={48} color="white" />
|
||||||
|
</SidebarButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Logout>
|
||||||
|
<LogoutIcon size={48} color="white" />
|
||||||
|
</Logout>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,21 @@ import styles from "../../styles";
|
||||||
export interface props {
|
export interface props {
|
||||||
name: string;
|
name: string;
|
||||||
onClick: any;
|
onClick: any;
|
||||||
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
export default function SidebarButton(props: props) {
|
export default function SidebarButton(props: props) {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: "flex", paddingBottom: 16 }}>
|
<div
|
||||||
|
style={{
|
||||||
|
paddingBottom: 16,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
onClick={props.onClick}
|
onClick={props.onClick}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
style={styles.sidebar_button}
|
style={styles.sidebar_button}
|
||||||
>
|
>
|
||||||
|
{props.children}
|
||||||
<p style={styles.text}>{props.name}</p>
|
<p style={styles.text}>{props.name}</p>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -68,6 +68,7 @@ const styles: { [key: string]: React.CSSProperties } = {
|
||||||
borderBottomLeftRadius: 32,
|
borderBottomLeftRadius: 32,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
borderBottomRightRadius: 0,
|
borderBottomRightRadius: 0,
|
||||||
|
justifyContent: "left",
|
||||||
},
|
},
|
||||||
sidebar_button: {
|
sidebar_button: {
|
||||||
backgroundColor: "#0b2322",
|
backgroundColor: "#0b2322",
|
||||||
|
@ -79,6 +80,7 @@ const styles: { [key: string]: React.CSSProperties } = {
|
||||||
borderBottomLeftRadius: 32,
|
borderBottomLeftRadius: 32,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
borderBottomRightRadius: 0,
|
borderBottomRightRadius: 0,
|
||||||
|
justifyContent: "left",
|
||||||
},
|
},
|
||||||
sidebar_wrapper: {
|
sidebar_wrapper: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|
Loading…
Reference in a new issue