diff --git a/dashboard/src/states/Dashboard/pages/Home/components/ProjectBox/ProjectBox.jsx b/dashboard/src/states/Dashboard/pages/Home/components/ProjectBox/ProjectBox.jsx new file mode 100644 index 0000000..0e3d0cf --- /dev/null +++ b/dashboard/src/states/Dashboard/pages/Home/components/ProjectBox/ProjectBox.jsx @@ -0,0 +1,32 @@ +import {Avatar, Box, Divider, Typography} from "@mui/material"; +import {ProjectContext} from "@/states/Dashboard/contexts/Project"; +import {useContext} from "react"; +import {useNavigate} from "react-router-dom"; + +export const ProjectBox = ({project}) => { + + const boxStyle = {cursor: "pointer", "&:hover": {backgroundColor: "#eee"}, + "&:active": {backgroundColor: "#ddd", scale: "0.95"}, "&:focus": {outline: "none"}, + transition: "all 0.1s ease-in-out", userSelect: "none"} + + const {setCurrentProject} = useContext(ProjectContext); + const navigate = useNavigate(); + + const switchProject = () => { + setCurrentProject(project); + navigate("/projects/" + project.id + "/stats"); + } + + return ( + + + {project.name.charAt(0).toUpperCase()} + + + + + {project.name} + + ); +} \ No newline at end of file diff --git a/dashboard/src/states/Dashboard/pages/Home/components/ProjectBox/index.js b/dashboard/src/states/Dashboard/pages/Home/components/ProjectBox/index.js new file mode 100644 index 0000000..634f9ce --- /dev/null +++ b/dashboard/src/states/Dashboard/pages/Home/components/ProjectBox/index.js @@ -0,0 +1 @@ +export {ProjectBox as default} from "./ProjectBox.jsx"; \ No newline at end of file