From 729c219369e288a60432f0e7722dae36088c0bda Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 22 May 2022 14:34:19 -0700 Subject: Convert remove to snackbar --- modern/src/common/components/RemoveDialog.js | 37 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'modern/src/common/components/RemoveDialog.js') diff --git a/modern/src/common/components/RemoveDialog.js b/modern/src/common/components/RemoveDialog.js index cbdbb05d..a11af4c2 100644 --- a/modern/src/common/components/RemoveDialog.js +++ b/modern/src/common/components/RemoveDialog.js @@ -1,15 +1,23 @@ import React from 'react'; import Button from '@material-ui/core/Button'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; +import { Snackbar, makeStyles } from '@material-ui/core'; import { useTranslation } from './LocalizationProvider'; import { useCatch } from '../../reactHelper'; +import { snackBarDurationLongMs } from '../util/duration'; + +const useStyles = makeStyles((theme) => ({ + button: { + height: 'auto', + marginTop: 0, + marginBottom: 0, + color: theme.palette.colors.negative, + }, +})); const RemoveDialog = ({ open, endpoint, itemId, onResult, }) => { + const classes = useStyles(); const t = useTranslation(); const handleRemove = useCatch(async () => { @@ -22,18 +30,17 @@ const RemoveDialog = ({ }); return ( - { onResult(false); }} - > - - {t('sharedRemoveConfirm')} - - - - - - + autoHideDuration={snackBarDurationLongMs} + onClose={() => onResult(false)} + message={t('sharedRemoveConfirm')} + action={( + + )} + /> ); }; -- cgit v1.2.3