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';
@@ -18,15 +17,10 @@ function PaymentReceiveDrawer({
isOpen,
payload: { paymentReceiveId },
closeDrawer,
}) {
// handle close Drawer
const handleDrawerClose = () => {
closeDrawer(name);
};
return (
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
<Drawer isOpen={isOpen} name={name}>
<DrawerSuspense>
<PaymentReceiveDrawerContent paymentReceiveId={paymentReceiveId} />
</DrawerSuspense>
@@ -34,4 +28,4 @@ function PaymentReceiveDrawer({
);
}
export default compose(withDrawers(), withDrawerActions)(PaymentReceiveDrawer);
export default compose(withDrawers())(PaymentReceiveDrawer);

View File

@@ -1,6 +1,6 @@
import React, { createContext, useContext } from 'react';
import { usePaymentReceive } from 'hooks/query';
import DashboardInsider from 'components/Dashboard/DashboardInsider';
import { DrawerHeaderContent, DashboardInsider } from 'components';
const PaymentReceiveDrawerContext = createContext();
@@ -20,6 +20,7 @@ function PaymentReceiveDrawerProvider({ paymentReceiveId, ...props }) {
return (
<DashboardInsider loading={isPaymentReceiveLoading}>
<DrawerHeaderContent name={'payment-receive-drawer'} />
<PaymentReceiveDrawerContext.Provider value={provider} {...props} />
</DashboardInsider>
);