From 835a3cc7fd7195566663a17725ba85513f320f1b Mon Sep 17 00:00:00 2001 From: Md Asif Date: Sat, 21 Dec 2024 18:11:47 +0530 Subject: [PATCH] Refactor cabinet maintenance routing and add CabinetMaintenance component; update Header and main router configuration --- src/components/Button.jsx | 19 +++++++++++++++ src/components/Header.jsx | 2 +- src/main.jsx | 6 ++--- src/pages/CabinetMaintenance.jsx | 41 ++++++++++++++++++++++++++++++++ tailwind.config.js | 1 + 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 src/components/Button.jsx create mode 100644 src/pages/CabinetMaintenance.jsx diff --git a/src/components/Button.jsx b/src/components/Button.jsx new file mode 100644 index 0000000..fd6c00e --- /dev/null +++ b/src/components/Button.jsx @@ -0,0 +1,19 @@ +import PropTypes from 'prop-types'; + +function Button({text, onClick}) { + return ( + + ) +} + +Button.propTypes = { + text: PropTypes.string.isRequired, + onClick: PropTypes.func.isRequired +}; + +export default Button; diff --git a/src/components/Header.jsx b/src/components/Header.jsx index 54bdd11..d2eccfc 100644 --- a/src/components/Header.jsx +++ b/src/components/Header.jsx @@ -25,7 +25,7 @@ function Header() { name: "lockerOperation", submenu: [ { name: "accountCreation", path: "account-creation" }, - { name: "cabinetMaintenance", path: "cabinet-maintenance" }, + { name: "cabinetMaintenance", path: "operation/cabinet" }, { name: "lockerMaintenance", path: "locker-maintenance" }, { name: "rentPenaltyCollection", path: "rent-collection" }, { name: "chargeManagement", path: "charge-management" }, diff --git a/src/main.jsx b/src/main.jsx index 5aa6351..382cc35 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -4,8 +4,8 @@ import App from './App.jsx' import './index.css' import './i18n' import { createBrowserRouter, RouterProvider } from 'react-router-dom'; -import Placeholder from './pages/Placeholder.jsx'; import Home from './pages/Home.jsx' +import CabinetMaintenace from './pages/CabinetMaintenance.jsx' const router = createBrowserRouter([ { @@ -17,8 +17,8 @@ const router = createBrowserRouter([ element: }, { - path: 'cabinet-maintenance', - element: + path: 'operation/cabinet', + element: } ] } diff --git a/src/pages/CabinetMaintenance.jsx b/src/pages/CabinetMaintenance.jsx new file mode 100644 index 0000000..58e9428 --- /dev/null +++ b/src/pages/CabinetMaintenance.jsx @@ -0,0 +1,41 @@ +import { useState } from "react"; +import { useNavigate } from "react-router-dom"; +import FormBox from "../components/FormBox"; +import Button from "../components/Button"; + +function CabinetMaintenace() { + const navigate = useNavigate(); + const [operation, setOperation] = useState(""); + + const handleNext = () => { + if (operation === "") { + alert("Please select an operation."); + } + navigate(operation) + }; + + return ( +
+ +
+
+ + +
+
+
+
+ ); +} + +export default CabinetMaintenace; diff --git a/tailwind.config.js b/tailwind.config.js index 8661cb3..00db2eb 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -9,6 +9,7 @@ export default { colors: { white: '#FFFFFF', black: '#000000', + grey: '#979797', transparent: 'transparent', primary: { DEFAULT: '#008C46',