Routing using useNavigate
This commit is contained in:
1 parent
a6f4601da5
commit
551fa4de81
4 files changed
+18
-17
No files matched your search
@@ -18,11 +18,11 @@ import SettingsIcon from "../../assets/Images/Icon-setting-gray.png";
|
|||||||
function DashboardMenu() {
|
function DashboardMenu() {
|
||||||
return (
|
return (
|
||||||
<div className="dashboard-menu-container">
|
<div className="dashboard-menu-container">
|
||||||
{DashboardMenuButton(Monitors, "Monitors")}
|
{DashboardMenuButton(Monitors, "Monitors", "/monitors")}
|
||||||
{DashboardMenuButton(Incidents, "Incidents")}
|
{DashboardMenuButton(Incidents, "Incidents", "/incidents")}
|
||||||
{DashboardMenuButton(SensorsIcon, "Status Pages")}
|
{DashboardMenuButton(SensorsIcon, "Status Pages", "/status")}
|
||||||
{DashboardMenuButton(AllInclusiveIcon, "Integrations")}
|
{DashboardMenuButton(AllInclusiveIcon, "Integrations", "/integrations")}
|
||||||
{DashboardMenuButton(SettingsIcon, "Settings")}
|
{DashboardMenuButton(SettingsIcon, "Settings", "/settings")}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a menu button with an icon and title.
|
* Renders a menu button with an icon and title.
|
||||||
@@ -10,11 +11,13 @@ import React, { useState } from "react";
|
|||||||
* @returns {React.ReactElement} The rendered menu button component.
|
* @returns {React.ReactElement} The rendered menu button component.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const DashboardMenuButton = (icon, title) => {
|
const DashboardMenuButton = (icon, title, to) => {
|
||||||
const [isActive, setIsActive] = useState(false);
|
const [isActive, setIsActive] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
setIsActive(!isActive);
|
setIsActive(!isActive);
|
||||||
|
navigate(to);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
.home-layout {
|
.home-layout {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
|
||||||
margin-left: 250px;
|
|
||||||
flex: 1;
|
|
||||||
padding: 20px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
margin-left: 250px;
|
||||||
|
flex: 1;
|
||||||
|
/* padding: 20px; */
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
.monitors {
|
.monitors {
|
||||||
width: 90vw;
|
width: 70vw;
|
||||||
min-height: 100vh;
|
|
||||||
padding: 4vw;
|
padding: 4vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user