feat(ImportFlowDialog): close dialog when clicked outside
This commit is contained in:
@@ -18,11 +18,7 @@ import FileUploadInput from 'components/FileUploadInput';
|
|||||||
import useImportFlow from 'hooks/useImportFlow';
|
import useImportFlow from 'hooks/useImportFlow';
|
||||||
|
|
||||||
function ImportFlowDialog(props) {
|
function ImportFlowDialog(props) {
|
||||||
const {
|
const { open = true, 'data-test': dataTest = 'import-flow-dialog' } = props;
|
||||||
onClose,
|
|
||||||
open = true,
|
|
||||||
'data-test': dataTest = 'import-flow-dialog',
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const [hasParsingError, setParsingError] = React.useState(false);
|
const [hasParsingError, setParsingError] = React.useState(false);
|
||||||
const [selectedFile, setSelectedFile] = React.useState(null);
|
const [selectedFile, setSelectedFile] = React.useState(null);
|
||||||
@@ -72,6 +68,10 @@ function ImportFlowDialog(props) {
|
|||||||
fileReader.readAsText(selectedFile);
|
fileReader.readAsText(selectedFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClose = () => {
|
||||||
|
navigate('..');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onClose={onClose} data-test={dataTest}>
|
<Dialog open={open} onClose={onClose} data-test={dataTest}>
|
||||||
<DialogTitle>{formatMessage('importFlowDialog.title')}</DialogTitle>
|
<DialogTitle>{formatMessage('importFlowDialog.title')}</DialogTitle>
|
||||||
@@ -102,7 +102,7 @@ function ImportFlowDialog(props) {
|
|||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => navigate('..')}
|
onClick={onClose}
|
||||||
data-test="import-flow-dialog-close-button"
|
data-test="import-flow-dialog-close-button"
|
||||||
>
|
>
|
||||||
{formatMessage('importFlowDialog.close')}
|
{formatMessage('importFlowDialog.close')}
|
||||||
@@ -150,7 +150,6 @@ function ImportFlowDialog(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImportFlowDialog.propTypes = {
|
ImportFlowDialog.propTypes = {
|
||||||
onClose: PropTypes.func.isRequired,
|
|
||||||
open: PropTypes.bool,
|
open: PropTypes.bool,
|
||||||
'data-test': PropTypes.string,
|
'data-test': PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user