mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: sharable payment link dialog
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
20
packages/webapp/src/components/Dialog/DialogProvider.tsx
Normal file
20
packages/webapp/src/components/Dialog/DialogProvider.tsx
Normal 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>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user