Improve dialog logic, add "asDialog" helper
This commit is contained in:
parent
822949408f
commit
a4feed24a8
10 changed files with 131 additions and 77 deletions
|
@ -1,18 +1,14 @@
|
|||
import React from 'react';
|
||||
import { IconPosition } from './DialogIcon';
|
||||
import { DialogContextType, DialogWrapperContextType } from './types';
|
||||
|
||||
type Callback<T> = ((value: T) => void) | React.Dispatch<React.SetStateAction<T>>;
|
||||
|
||||
interface DialogContextType {
|
||||
setIcon: Callback<React.ReactNode>;
|
||||
setFooter: Callback<React.ReactNode>;
|
||||
setIconPosition: Callback<IconPosition>;
|
||||
}
|
||||
|
||||
const DialogContext = React.createContext<DialogContextType>({
|
||||
export const DialogContext = React.createContext<DialogContextType>({
|
||||
setIcon: () => null,
|
||||
setFooter: () => null,
|
||||
setIconPosition: () => null,
|
||||
});
|
||||
|
||||
export default DialogContext;
|
||||
export const DialogWrapperContext = React.createContext<DialogWrapperContextType>({
|
||||
props: {},
|
||||
setProps: () => null,
|
||||
close: () => null,
|
||||
});
|
||||
|
|
Reference in a new issue