Compare commits
5 Commits
e4969938c3
...
db918ba7c7
Author | SHA1 | Date | |
---|---|---|---|
db918ba7c7 | |||
dedc7e1608 | |||
1c8348dee5 | |||
04e4d011ff | |||
116e883e91 |
@ -3,13 +3,19 @@ import Sidebar from '../Sidebar';
|
|||||||
import Orders from '../Orders';
|
import Orders from '../Orders';
|
||||||
import Masters from '../Masters';
|
import Masters from '../Masters';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
const LayoutArm = ({ currentPage, onSelectPage }) => (
|
const LayoutArm = () => (
|
||||||
<Flex h='100vh'>
|
<Flex h='100vh'>
|
||||||
<Sidebar onSelectPage={onSelectPage} />
|
<Sidebar />
|
||||||
<Box flex='1' bg='gray.50'>
|
<Box flex='1' bg='gray.50'>
|
||||||
{currentPage === 'orders' && <Orders />}
|
<Routes>
|
||||||
{currentPage === 'masters' && <Masters />}
|
<Route>
|
||||||
|
<Route index element={<Navigate to='orders' replace />} />
|
||||||
|
<Route path='orders' element={<Orders />} />
|
||||||
|
<Route path='masters' element={<Masters />} />
|
||||||
|
</Route>
|
||||||
|
</Routes>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
@ -2,7 +2,9 @@ import { Box, Button, Heading, VStack } from '@chakra-ui/react';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Divider } from '@chakra-ui/react';
|
import { Divider } from '@chakra-ui/react';
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
const Sidebar = ({ onSelectPage }) => (
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const Sidebar = () => (
|
||||||
<Box
|
<Box
|
||||||
borderRight='1px solid black'
|
borderRight='1px solid black'
|
||||||
bg='gray.50'
|
bg='gray.50'
|
||||||
@ -18,7 +20,8 @@ const Sidebar = ({ onSelectPage }) => (
|
|||||||
<VStack align='start' spacing='4'>
|
<VStack align='start' spacing='4'>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Button
|
<Button
|
||||||
onClick={() => onSelectPage('orders')}
|
as={Link}
|
||||||
|
to='orders'
|
||||||
w='100%'
|
w='100%'
|
||||||
colorScheme='green'
|
colorScheme='green'
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
@ -27,7 +30,8 @@ const Sidebar = ({ onSelectPage }) => (
|
|||||||
</Button>
|
</Button>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Button
|
<Button
|
||||||
onClick={() => onSelectPage('masters')}
|
as={Link}
|
||||||
|
to='masters'
|
||||||
w='100%'
|
w='100%'
|
||||||
colorScheme='green'
|
colorScheme='green'
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
|
@ -2,9 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import LayoutArm from '../../components/LayoutArm';
|
import LayoutArm from '../../components/LayoutArm';
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const [currentPage, setCurrentPage] = useState('orders');
|
return <LayoutArm />;
|
||||||
|
|
||||||
return <LayoutArm currentPage={currentPage} onSelectPage={setCurrentPage} />;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
@ -16,9 +16,10 @@ const Routers = () => {
|
|||||||
<Route path='order-form' element={<OrderForm />} />
|
<Route path='order-form' element={<OrderForm />} />
|
||||||
<Route path='order-view' element={<OrderView />} />
|
<Route path='order-view' element={<OrderView />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path='/dry-wash/arm' element={<Arm />}></Route>
|
<Route path='/dry-wash/arm/*' element={<Arm />}></Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user