Created the PowerItem.jsx

This commit is contained in:
Mathias Wagner 2023-05-30 18:11:24 +02:00
parent 131abe16e9
commit 1a4bb50f3e
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -0,0 +1,15 @@
import "./styles.sass";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {useLocation, useNavigate} from "react-router-dom";
export const PowerItem = ({icon, name, path}) => {
const location = useLocation();
const navigate = useNavigate();
return (
<div className={"power-item" + (location.pathname === path ? " power-item-active" : "")} onClick={() => navigate(path)}>
<FontAwesomeIcon icon={icon}/>
<h2>{name}</h2>
</div>
);
}