-
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.
Comment deletion functionality (#154)
* introduce Dialog component * comment deletion functionality * remove autoFocus
- Loading branch information
1 parent
5dcb80b
commit d67490d
Showing
4 changed files
with
111 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {Dialog as MuiDialog, DialogActions, DialogContent, DialogContentText, DialogTitle} from '@mui/material' | ||
import {FC, ReactNode} from 'react' | ||
|
||
type DialogProps = { | ||
open: boolean | ||
close: () => void | ||
title?: ReactNode | ||
contentText?: ReactNode | ||
actions?: ReactNode | ||
} | ||
|
||
// inspired by: https://mui.com/material-ui/react-dialog/#alerts | ||
export const Dialog: FC<DialogProps> = ({open, close, title, contentText, actions}) => { | ||
return ( | ||
<MuiDialog | ||
open={open} | ||
onClose={close} | ||
aria-labelledby="alert-dialog-title" | ||
aria-describedby="alert-dialog-description" | ||
> | ||
{title && <DialogTitle id="alert-dialog-title">{title}</DialogTitle>} | ||
{contentText && ( | ||
<DialogContent> | ||
<DialogContentText id="alert-dialog-description">{contentText}</DialogContentText> | ||
</DialogContent> | ||
)} | ||
{actions && <DialogActions>{actions}</DialogActions>} | ||
</MuiDialog> | ||
) | ||
} |
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