Compare commits

..

5 Commits

Author SHA1 Message Date
db918ba7c7 Merge pull request 'feat: add router to the arm page (#14)' (#20) from feature/router-arm into main
Some checks failed
it-academy/dry-wash-pl/pipeline/pr-feat/landing There was a failure building this commit
Reviewed-on: #20
2024-11-17 11:02:45 +03:00
dedc7e1608 feat: convert link to button (#14)
All checks were successful
it-academy/dry-wash-pl/pipeline/pr-main This commit looks good
it-academy/dry-wash-pl/pipeline/head This commit looks good
2024-11-16 18:24:51 +03:00
1c8348dee5 Merge remote-tracking branch 'origin/feature/router-arm' into feature/router-arm
All checks were successful
it-academy/dry-wash-pl/pipeline/pr-main This commit looks good
# Conflicts:
#	src/components/Sidebar/Sidebar.tsx
#	src/routes.tsx
2024-11-16 17:26:22 +03:00
04e4d011ff feat: add router to the arm page (#14) 2024-11-16 17:05:21 +03:00
116e883e91 feat: add router to the arm page (#14) 2024-11-09 19:34:12 +03:00
4 changed files with 20 additions and 11 deletions

View File

@ -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 = () => (
<Flex h='100vh'>
<Sidebar onSelectPage={onSelectPage} />
<Sidebar />
<Box flex='1' bg='gray.50'>
{currentPage === 'orders' && <Orders />}
{currentPage === 'masters' && <Masters />}
<Routes>
<Route>
<Route index element={<Navigate to='orders' replace />} />
<Route path='orders' element={<Orders />} />
<Route path='masters' element={<Masters />} />
</Route>
</Routes>
</Box>
</Flex>
);

View File

@ -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 = () => (
<Box
borderRight='1px solid black'
bg='gray.50'
@ -18,7 +20,8 @@ const Sidebar = ({ onSelectPage }) => (
<VStack align='start' spacing='4'>
<Divider />
<Button
onClick={() => onSelectPage('orders')}
as={Link}
to='orders'
w='100%'
colorScheme='green'
variant='ghost'
@ -27,7 +30,8 @@ const Sidebar = ({ onSelectPage }) => (
</Button>
<Divider />
<Button
onClick={() => onSelectPage('masters')}
as={Link}
to='masters'
w='100%'
colorScheme='green'
variant='ghost'

View File

@ -2,9 +2,7 @@ import React, { useState } from 'react';
import LayoutArm from '../../components/LayoutArm';
const Page = () => {
const [currentPage, setCurrentPage] = useState('orders');
return <LayoutArm currentPage={currentPage} onSelectPage={setCurrentPage} />;
return <LayoutArm />;
};
export default Page;

View File

@ -16,9 +16,10 @@ const Routers = () => {
<Route path='order-form' element={<OrderForm />} />
<Route path='order-view' element={<OrderView />} />
</Route>
<Route path='/dry-wash/arm' element={<Arm />}></Route>
<Route path='/dry-wash/arm/*' element={<Arm />}></Route>
</Routes>
</Suspense>
);
};