Compare commits
No commits in common. "db918ba7c7a4d632a33e5387455d601fb56c6423" and "e4969938c321ba56ecf73218d90226bb46f44401" have entirely different histories.
db918ba7c7
...
e4969938c3
@ -3,19 +3,13 @@ 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 = () => (
|
||||
const LayoutArm = ({ currentPage, onSelectPage }) => (
|
||||
<Flex h='100vh'>
|
||||
<Sidebar />
|
||||
<Sidebar onSelectPage={onSelectPage} />
|
||||
<Box flex='1' bg='gray.50'>
|
||||
<Routes>
|
||||
<Route>
|
||||
<Route index element={<Navigate to='orders' replace />} />
|
||||
<Route path='orders' element={<Orders />} />
|
||||
<Route path='masters' element={<Masters />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
{currentPage === 'orders' && <Orders />}
|
||||
{currentPage === 'masters' && <Masters />}
|
||||
</Box>
|
||||
</Flex>
|
||||
);
|
||||
|
@ -2,9 +2,7 @@ import { Box, Button, Heading, VStack } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
import { Divider } from '@chakra-ui/react';
|
||||
import i18next from 'i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const Sidebar = () => (
|
||||
const Sidebar = ({ onSelectPage }) => (
|
||||
<Box
|
||||
borderRight='1px solid black'
|
||||
bg='gray.50'
|
||||
@ -20,8 +18,7 @@ const Sidebar = () => (
|
||||
<VStack align='start' spacing='4'>
|
||||
<Divider />
|
||||
<Button
|
||||
as={Link}
|
||||
to='orders'
|
||||
onClick={() => onSelectPage('orders')}
|
||||
w='100%'
|
||||
colorScheme='green'
|
||||
variant='ghost'
|
||||
@ -30,8 +27,7 @@ const Sidebar = () => (
|
||||
</Button>
|
||||
<Divider />
|
||||
<Button
|
||||
as={Link}
|
||||
to='masters'
|
||||
onClick={() => onSelectPage('masters')}
|
||||
w='100%'
|
||||
colorScheme='green'
|
||||
variant='ghost'
|
||||
|
@ -2,7 +2,9 @@ import React, { useState } from 'react';
|
||||
import LayoutArm from '../../components/LayoutArm';
|
||||
|
||||
const Page = () => {
|
||||
return <LayoutArm />;
|
||||
const [currentPage, setCurrentPage] = useState('orders');
|
||||
|
||||
return <LayoutArm currentPage={currentPage} onSelectPage={setCurrentPage} />;
|
||||
};
|
||||
|
||||
export default Page;
|
||||
|
@ -16,10 +16,9 @@ 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>
|
||||
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user