From 116e883e91460958f5f8458a91639ba418da8426 Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sat, 9 Nov 2024 19:34:12 +0300 Subject: [PATCH 1/3] feat: add router to the arm page (#14) --- src/components/LayoutArm/LayoutArm.tsx | 14 ++++++++---- src/components/Sidebar/Sidebar.tsx | 30 +++++++++++--------------- src/pages/arm/index.tsx | 4 +--- src/routes.tsx | 2 +- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/components/LayoutArm/LayoutArm.tsx b/src/components/LayoutArm/LayoutArm.tsx index db48c23..da99da0 100644 --- a/src/components/LayoutArm/LayoutArm.tsx +++ b/src/components/LayoutArm/LayoutArm.tsx @@ -3,13 +3,19 @@ import Sidebar from '../Sidebar'; import Orders from '../Orders'; import Masters from '../Masters'; import React from 'react'; +import { Navigate, Route, Routes } from 'react-router-dom'; -const LayoutArm = ({ currentPage, onSelectPage }) => ( +const LayoutArm = () => ( - + - {currentPage === 'orders' && } - {currentPage === 'masters' && } + + + } /> + } /> + } /> + + ); diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index a88e350..38d9b38 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -1,8 +1,8 @@ import { Box, Button, Heading, VStack } from '@chakra-ui/react'; import React from 'react'; import { Divider } from '@chakra-ui/react'; - -const Sidebar = ({ onSelectPage }) => ( +import { Link } from 'react-router-dom'; +const Sidebar = () => ( ( - + + + - + + + diff --git a/src/pages/arm/index.tsx b/src/pages/arm/index.tsx index fda55d0..02d21c4 100644 --- a/src/pages/arm/index.tsx +++ b/src/pages/arm/index.tsx @@ -2,9 +2,7 @@ import React, { useState } from 'react'; import LayoutArm from '../../components/LayoutArm'; const Page = () => { - const [currentPage, setCurrentPage] = useState('orders'); - - return ; + return ; }; export default Page; diff --git a/src/routes.tsx b/src/routes.tsx index 6728eb6..f9ff75c 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -9,7 +9,7 @@ const Routers = () => { }> }> - }> + }> ); }; -- 2.45.2 From 04e4d011ffb558a20ae6436ed119603ce293f3ff Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sat, 9 Nov 2024 19:34:12 +0300 Subject: [PATCH 2/3] feat: add router to the arm page (#14) --- src/components/LayoutArm/LayoutArm.tsx | 14 ++++++++---- src/components/Sidebar/Sidebar.tsx | 30 +++++++++++--------------- src/pages/arm/index.tsx | 4 +--- src/routes.tsx | 3 ++- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/components/LayoutArm/LayoutArm.tsx b/src/components/LayoutArm/LayoutArm.tsx index db48c23..da99da0 100644 --- a/src/components/LayoutArm/LayoutArm.tsx +++ b/src/components/LayoutArm/LayoutArm.tsx @@ -3,13 +3,19 @@ import Sidebar from '../Sidebar'; import Orders from '../Orders'; import Masters from '../Masters'; import React from 'react'; +import { Navigate, Route, Routes } from 'react-router-dom'; -const LayoutArm = ({ currentPage, onSelectPage }) => ( +const LayoutArm = () => ( - + - {currentPage === 'orders' && } - {currentPage === 'masters' && } + + + } /> + } /> + } /> + + ); diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index 86f64f5..9c3994d 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -2,7 +2,9 @@ import { Box, Button, Heading, VStack } from '@chakra-ui/react'; import React from 'react'; import { Divider } from '@chakra-ui/react'; import i18next from 'i18next'; -const Sidebar = ({ onSelectPage }) => ( +import { Link } from 'react-router-dom'; + +const Sidebar = () => ( ( - + + + - + + + diff --git a/src/pages/arm/index.tsx b/src/pages/arm/index.tsx index fda55d0..02d21c4 100644 --- a/src/pages/arm/index.tsx +++ b/src/pages/arm/index.tsx @@ -2,9 +2,7 @@ import React, { useState } from 'react'; import LayoutArm from '../../components/LayoutArm'; const Page = () => { - const [currentPage, setCurrentPage] = useState('orders'); - - return ; + return ; }; export default Page; diff --git a/src/routes.tsx b/src/routes.tsx index ab2dbfa..77af977 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -16,9 +16,10 @@ const Routers = () => { } /> } /> - }> + }> + ); }; -- 2.45.2 From dedc7e16081fb1ad0c0ad136d08b9576e5325942 Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sat, 16 Nov 2024 18:24:51 +0300 Subject: [PATCH 3/3] feat: convert link to button (#14) --- src/components/Sidebar/Sidebar.tsx | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index 9c3994d..4ae207a 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -19,17 +19,25 @@ const Sidebar = () => ( - - - + - - - + -- 2.45.2