This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new functionalities to useDialog
- add ids to the dialogs to support stacking - add optional callback functions to the openDialog functions - dialog options can now be passed to the openDialog function
- Loading branch information
Showing
5 changed files
with
166 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export interface DialogState { | ||
id: string; | ||
content: string | React.ReactNode; | ||
} | ||
|
||
export interface DialogOptions { | ||
closeOnOffsiteClick?: boolean; | ||
closeOnEscape?: boolean; | ||
removeDefaultClasses?: boolean; | ||
wrapperClassName?: string; | ||
cardClassName?: string; | ||
cardBodyClassName?: string; | ||
cardActionsClassName?: string; | ||
confirmButtonClassName?: string; | ||
cancelButtonClassName?: string; | ||
confirmButtonLabel?: string; | ||
cancelButtonLabel?: string; | ||
disableConfirmButton?: boolean; | ||
disableCancelButton?: boolean; | ||
} | ||
|
||
export type Dialog = DialogState & DialogOptions; | ||
|
||
export interface Resolve { | ||
dialogID: string; | ||
resolve: (value: any) => void; | ||
} | ||
|
||
export interface GlobalState { | ||
dialogs: Dialog[]; | ||
resolves: Resolve[]; | ||
} |