feat: sharable payment link dialog

This commit is contained in:
Ahmed Bouhuolia
2024-09-15 19:28:43 +02:00
parent 9517b4e279
commit 542e61dbfc
17 changed files with 476 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ import withDialogActions from '@/containers/Dialog/withDialogActions';
import { compose } from '@/utils';
import '@/style/components/Dialog/Dialog.scss';
import { DialogProvider } from './DialogProvider';
function DialogComponent(props) {
const { name, children, closeDialog, onClose } = props;
@@ -15,7 +16,7 @@ function DialogComponent(props) {
};
return (
<Dialog {...props} onClose={handleClose}>
{children}
<DialogProvider value={props}>{children}</DialogProvider>
</Dialog>
);
}

View File

@@ -0,0 +1,20 @@
import React, { createContext, useContext, ReactNode } from 'react';
const DialogContext = createContext<any>(null);
export const useDialogContext = () => {
return useContext(DialogContext);
};
interface DialogProviderProps {
value: any;
children: ReactNode;
}
export const DialogProvider: React.FC<DialogProviderProps> = ({ value, children }) => {
return (
<DialogContext.Provider value={value}>
{children}
</DialogContext.Provider>
);
};