Files
Checkmate/Client/src/Components/Dashboard/DashboardMenuButton/index.jsx
T

32 lines
849 B
React
Raw Normal View History

2024-06-06 12:27:36 +03:30
import "./index.css";
import React, { useState } from "react";
2024-06-07 13:20:07 +03:30
import { useNavigate } from "react-router-dom";
2024-06-06 12:27:36 +03:30
/**
* Renders a menu button with an icon and title.
*
* @component
* @param {React.ElementType} icon - The icon component to be rendered.
* @param {string} title - The title of the menu button.
* @returns {React.ReactElement} The rendered menu button component.
*/
2024-06-09 22:48:14 +03:30
const DashboardMenuButton = (icon, title, to, isActive, onClick) => {
2024-06-06 12:27:36 +03:30
const handleClick = () => {
2024-06-09 22:48:14 +03:30
onClick();
2024-06-06 12:27:36 +03:30
};
return (
<div
className={`icon-container ${isActive ? "active" : ""}`}
onClick={handleClick}
>
<img className="icon" src={icon} alt="Monitors" />
<div className="text-container">
<span className="dashboard-menu-text">{title}</span>
</div>
</div>
);
};
export default DashboardMenuButton;