refactoring(*): paper drawer.

This commit is contained in:
elforjani3
2021-04-28 20:39:14 +02:00
parent 1fbfd7693f
commit 279dfb012c
8 changed files with 18 additions and 41 deletions

View File

@@ -1,6 +1,5 @@
import React, { lazy } from 'react';
import withDrawers from 'containers/Drawer/withDrawers';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { Drawer, DrawerSuspense } from 'components';
import { compose } from 'utils';
@@ -15,17 +14,10 @@ const ReceiptDrawer = ({
//#withDrawer
isOpen,
payload: { receiptId },
closeDrawer,
}) => {
// handle close Drawer
const handleDrawerClose = () => {
closeDrawer(name);
};
return (
<div>
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
<Drawer isOpen={isOpen} name={name}>
<DrawerSuspense>
<ReceiptDrawerContent receiptId={receiptId} />
</DrawerSuspense>
@@ -34,4 +26,4 @@ const ReceiptDrawer = ({
);
};
export default compose(withDrawers(), withDrawerActions)(ReceiptDrawer);
export default compose(withDrawers())(ReceiptDrawer);

View File

@@ -1,6 +1,6 @@
import React, { createContext, useContext } from 'react';
import { useReceipt } from 'hooks/query';
import DashboardInsider from 'components/Dashboard/DashboardInsider';
import { DrawerHeaderContent, DashboardInsider } from 'components';
const ReceiptDrawerContext = createContext();
@@ -23,6 +23,7 @@ function ReceiptDrawerProvider({ receiptId, ...props }) {
return (
<DashboardInsider loading={isReceiptLoading}>
<DrawerHeaderContent name={'receipt-drawer'} />
<ReceiptDrawerContext.Provider value={provider} {...props} />
</DashboardInsider>
);