F #3951: Fix close button dialog as x (#965)

This commit is contained in:
Sergio Betanzos authored and GitHub committed 2021-03-12 14:38:59 +01:00
1 parent f20092256d
commit 3e019b0ced
1 file changed
+26 -20
@@ -3,14 +3,15 @@ import PropTypes from 'prop-types'
import {
useMediaQuery,
Button,
Dialog,
DialogTitle,
DialogContent,
DialogActions,
Typography,
IconButton,
makeStyles
} from '@material-ui/core'
import { Close as CloseIcon } from '@material-ui/icons'
import { SubmitButton } from 'client/components/FormControl'
import { Tr } from 'client/components/HOC'
@@ -25,6 +26,11 @@ const useStyles = makeStyles(theme => ({
width: '100%',
height: '100%'
}
},
closeButton: {
position: 'absolute',
right: '0.5em',
top: '0.5em'
}
}))
@@ -59,30 +65,30 @@ const DialogConfirmation = memo(
<DialogTitle disableTypography>
<Typography variant='h6'>{title}</Typography>
{subheader && <Typography variant='subtitle1'>{subheader}</Typography>}
{handleCancel && (
<IconButton
aria-label="close"
className={classes.closeButton}
onClick={handleCancel}
data-cy='dg-cancel-button'
{...cancelButtonProps}
>
<CloseIcon />
</IconButton>
)}
</DialogTitle>
<DialogContent dividers {...contentProps}>
{children}
</DialogContent>
{(handleCancel || handleAccept) && (
{handleAccept && (
<DialogActions>
{handleCancel && (
<Button
onClick={handleCancel}
data-cy='dg-cancel-button'
{...cancelButtonProps}
>
{Tr(T.Cancel)}
</Button>
)}
{handleAccept && (
<SubmitButton
color='secondary'
data-cy='dg-accept-button'
onClick={handleAccept}
label={Tr(T.Accept)}
{...acceptButtonProps}
/>
)}
<SubmitButton
color='secondary'
data-cy='dg-accept-button'
onClick={handleAccept}
label={Tr(T.Accept)}
{...acceptButtonProps}
/>
</DialogActions>
)}
</Dialog>