mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-31 15:07:29 -08:00
* save work * fix reset styling * fix toast reducer * update non-react deps * update react libraries * remove jquery, use sanitize-html instead * add missing change * fix deps and dev deps * update workflow to target Node 16 * run @mui/codemod to remove @mui/styles * add default body font size * update react 17 to 18 * declare enum before use * add rel attr to links * fix font sizing issue * trailing commas * refactor deep destructuring Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import React from 'react';
|
|
import { styled } from '@mui/material/styles';
|
|
import Dialog from '@mui/material/Dialog';
|
|
import DialogContent from '@mui/material/DialogContent';
|
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
import IconButton from '@mui/material/IconButton';
|
|
import AddIcon from '@mui/icons-material/Add';
|
|
import CloseIcon from '@mui/icons-material/Close';
|
|
import Typography from '@mui/material/Typography';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { KnownHostForm } from 'forms';
|
|
|
|
import './KnownHostDialog.css';
|
|
|
|
const PREFIX = 'KnownHostDialog';
|
|
|
|
const classes = {
|
|
root: `${PREFIX}-root`
|
|
};
|
|
|
|
const StyledDialog = styled(Dialog)(({ theme }) => ({
|
|
[`&.${classes.root}`]: {
|
|
'& .dialog-title__wrapper': {
|
|
borderColor: theme.palette.grey[300]
|
|
}
|
|
}
|
|
}));
|
|
|
|
const KnownHostDialog = ({ handleClose, onRemove, onSubmit, isOpen, host }: any) => {
|
|
const { t } = useTranslation();
|
|
|
|
const mode = host ? 'edit' : 'add';
|
|
|
|
const handleOnClose = () => {
|
|
if (handleClose) {
|
|
handleClose();
|
|
}
|
|
};
|
|
|
|
return (
|
|
<StyledDialog className={'KnownHostDialog ' + classes.root} onClose={handleOnClose} open={isOpen}>
|
|
<DialogTitle className='dialog-title'>
|
|
<div className='dialog-title__wrapper'>
|
|
<Typography variant='h2'>{ t('KnownHostDialog.title', { mode }) }</Typography>
|
|
|
|
{handleClose ? (
|
|
<IconButton onClick={handleClose} size="large">
|
|
<CloseIcon fontSize='large' />
|
|
</IconButton>
|
|
) : null}
|
|
</div>
|
|
</DialogTitle>
|
|
<DialogContent className='dialog-content'>
|
|
<Typography className='dialog-content__subtitle' variant='subtitle1'>
|
|
{ t('KnownHostDialog.subtitle') }
|
|
</Typography>
|
|
<KnownHostForm onRemove={onRemove} onSubmit={onSubmit} host={host}></KnownHostForm>
|
|
</DialogContent>
|
|
</StyledDialog>
|
|
);
|
|
};
|
|
|
|
export default KnownHostDialog;
|