Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { ListItemButton, ListItemIcon } from "@mui/material";
import { ReactNode } from "react";
import useSidebar from "../../hooks/common/sidebar/useSidebar";
type SidebarButtonElementProps = {
icon: ReactNode;
label: string;
onClick?: () => void;
};
function SidebarButtonElement({
onClick,
label,
icon,
}: SidebarButtonElementProps) {
const { isOpen } = useSidebar();
return (
<div
onClick={onClick}
className="flex gap-2 mx-2 px-2 py-1 items-center max-w-full rounded text-gray-500 hover:bg-gray-50 cursor-pointer">
<div className="text-gray-500">{icon}</div>
{isOpen && <p className="text-sm flex-1">{label}</p>}
</div>
);
}
export default SidebarButtonElement;
|