From c7e368754413682b3d7124f9fa0e9cd8c116265e Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Thu, 16 Feb 2023 14:22:40 +0800 Subject: [PATCH] Added icons to sidebar buttons and cleaned up code --- src/components/Icons/HomeIcon/HomeIcon.tsx | 29 ++++++++++++++++ .../Icons/InventoryIcon/InventoryIcon.tsx | 31 +++++++++++++++++ .../Icons/LogoutIcon/LogoutIcon.tsx | 28 +++++++++++++++ src/components/Icons/LogsIcon/LogsIcon.tsx | 32 +++++++++++++++++ .../Icons/ProductsIcon/ProductsIcon.tsx | 31 +++++++++++++++++ src/components/Logout/Logout.tsx | 7 +++- src/components/Sidebar/Sidebar.tsx | 34 ++++++++++++++++--- .../SidebarButton/SidebarButton.tsx | 8 ++++- src/styles.tsx | 2 ++ 9 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 src/components/Icons/HomeIcon/HomeIcon.tsx create mode 100644 src/components/Icons/InventoryIcon/InventoryIcon.tsx create mode 100644 src/components/Icons/LogoutIcon/LogoutIcon.tsx create mode 100644 src/components/Icons/LogsIcon/LogsIcon.tsx create mode 100644 src/components/Icons/ProductsIcon/ProductsIcon.tsx diff --git a/src/components/Icons/HomeIcon/HomeIcon.tsx b/src/components/Icons/HomeIcon/HomeIcon.tsx new file mode 100644 index 0000000..54e01f1 --- /dev/null +++ b/src/components/Icons/HomeIcon/HomeIcon.tsx @@ -0,0 +1,29 @@ +import React from "react"; + +export interface props { + size: number; + color: string; +} +export default function HomeIcon(props: props) { + return ( +
+ + + + + + +
+ ); +} diff --git a/src/components/Icons/InventoryIcon/InventoryIcon.tsx b/src/components/Icons/InventoryIcon/InventoryIcon.tsx new file mode 100644 index 0000000..08d4836 --- /dev/null +++ b/src/components/Icons/InventoryIcon/InventoryIcon.tsx @@ -0,0 +1,31 @@ +import React from "react"; + +export interface props { + size: number; + color: string; +} +export default function InventoryIcon(props: props) { + return ( +
+ + + + + + + + +
+ ); +} diff --git a/src/components/Icons/LogoutIcon/LogoutIcon.tsx b/src/components/Icons/LogoutIcon/LogoutIcon.tsx new file mode 100644 index 0000000..cd9e70d --- /dev/null +++ b/src/components/Icons/LogoutIcon/LogoutIcon.tsx @@ -0,0 +1,28 @@ +import React from "react"; + +export interface props { + size: number; + color: string; +} +export default function LogoutIcon(props: props) { + return ( +
+ + + + + +
+ ); +} diff --git a/src/components/Icons/LogsIcon/LogsIcon.tsx b/src/components/Icons/LogsIcon/LogsIcon.tsx new file mode 100644 index 0000000..c1a90b5 --- /dev/null +++ b/src/components/Icons/LogsIcon/LogsIcon.tsx @@ -0,0 +1,32 @@ +import React from "react"; + +export interface props { + size: number; + color: string; +} +export default function LogsIcon(props: props) { + return ( +
+ + + + + + + + + +
+ ); +} diff --git a/src/components/Icons/ProductsIcon/ProductsIcon.tsx b/src/components/Icons/ProductsIcon/ProductsIcon.tsx new file mode 100644 index 0000000..5888276 --- /dev/null +++ b/src/components/Icons/ProductsIcon/ProductsIcon.tsx @@ -0,0 +1,31 @@ +import React from "react"; + +export interface props { + size: number; + color: string; +} +export default function ProductsIcon(props: props) { + return ( +
+ + + + + + + + +
+ ); +} diff --git a/src/components/Logout/Logout.tsx b/src/components/Logout/Logout.tsx index 3ad9e19..d4c01a4 100644 --- a/src/components/Logout/Logout.tsx +++ b/src/components/Logout/Logout.tsx @@ -9,7 +9,11 @@ export interface state { 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 dispatch = useDispatch(); @@ -29,6 +33,7 @@ export default function Logout() { variant="contained" style={styles.logout_button} > + {props.children}

Log Out

diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index 3d8189b..d153df7 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -1,8 +1,13 @@ import React from "react"; import styles from "../../styles"; import SidebarButton from "../SidebarButton/SidebarButton"; +import HomeIcon from "../Icons/HomeIcon/HomeIcon"; +import ProductsIcon from "../Icons/ProductsIcon/ProductsIcon"; import { useNavigate } from "react-router-dom"; 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 { minimized: { value: boolean; @@ -14,11 +19,30 @@ export default function Sidebar() { const navigate = useNavigate(); return (
- navigate("/")} name="Dashboard" /> - navigate("/Products")} name="Products" /> - navigate("/Inventory")} name="Inventory" /> - navigate("/Logs")} name="Logs" /> - +
+ navigate("/")} name="Dashboard"> + + + navigate("/Products")} name="Products"> + + + navigate("/Inventory")} name="Inventory"> + + + navigate("/Logs")} name="Logs"> + + +
+ + + +
); } diff --git a/src/components/SidebarButton/SidebarButton.tsx b/src/components/SidebarButton/SidebarButton.tsx index 76e650b..f8534c6 100644 --- a/src/components/SidebarButton/SidebarButton.tsx +++ b/src/components/SidebarButton/SidebarButton.tsx @@ -5,15 +5,21 @@ import styles from "../../styles"; export interface props { name: string; onClick: any; + children: React.ReactNode; } export default function SidebarButton(props: props) { return ( -
+
diff --git a/src/styles.tsx b/src/styles.tsx index c78deb2..90a7219 100644 --- a/src/styles.tsx +++ b/src/styles.tsx @@ -68,6 +68,7 @@ const styles: { [key: string]: React.CSSProperties } = { borderBottomLeftRadius: 32, borderTopRightRadius: 0, borderBottomRightRadius: 0, + justifyContent: "left", }, sidebar_button: { backgroundColor: "#0b2322", @@ -79,6 +80,7 @@ const styles: { [key: string]: React.CSSProperties } = { borderBottomLeftRadius: 32, borderTopRightRadius: 0, borderBottomRightRadius: 0, + justifyContent: "left", }, sidebar_wrapper: { display: "flex",