|
@@ -9,8 +9,22 @@ import {
|
|
import { DialogContainerProps } from './Types';
|
|
import { DialogContainerProps } from './Types';
|
|
import CustomDialogTitle from './CustomDialogTitle';
|
|
import CustomDialogTitle from './CustomDialogTitle';
|
|
import CustomButton from '../customButton/CustomButton';
|
|
import CustomButton from '../customButton/CustomButton';
|
|
|
|
+import CodeView from '../code/CodeView';
|
|
|
|
|
|
const useStyles = makeStyles((theme: Theme) => ({
|
|
const useStyles = makeStyles((theme: Theme) => ({
|
|
|
|
+ wrapper: {
|
|
|
|
+ display: 'flex',
|
|
|
|
+ },
|
|
|
|
+ block: {
|
|
|
|
+ borderRadius: 8,
|
|
|
|
+ backgroundColor: '#fff',
|
|
|
|
+ },
|
|
|
|
+ dialog: {
|
|
|
|
+ minWidth: 480,
|
|
|
|
+ },
|
|
|
|
+ code: {
|
|
|
|
+ height: '100%',
|
|
|
|
+ },
|
|
actions: {
|
|
actions: {
|
|
paddingTop: theme.spacing(2),
|
|
paddingTop: theme.spacing(2),
|
|
justifyContent: 'space-between',
|
|
justifyContent: 'space-between',
|
|
@@ -30,6 +44,9 @@ const DialogTemplate: FC<DialogContainerProps> = ({
|
|
showCancel = true,
|
|
showCancel = true,
|
|
showCloseIcon = true,
|
|
showCloseIcon = true,
|
|
leftActions,
|
|
leftActions,
|
|
|
|
+ // needed for code mode
|
|
|
|
+ showCode = false,
|
|
|
|
+ codeBlocksData = [],
|
|
}) => {
|
|
}) => {
|
|
const { t } = useTranslation('btn');
|
|
const { t } = useTranslation('btn');
|
|
const cancel = cancelLabel || t('cancel');
|
|
const cancel = cancelLabel || t('cancel');
|
|
@@ -38,33 +55,38 @@ const DialogTemplate: FC<DialogContainerProps> = ({
|
|
const onCancel = handleCancel || handleClose;
|
|
const onCancel = handleCancel || handleClose;
|
|
|
|
|
|
return (
|
|
return (
|
|
- <>
|
|
|
|
- <CustomDialogTitle onClose={handleClose} showCloseIcon={showCloseIcon}>
|
|
|
|
- {title}
|
|
|
|
- </CustomDialogTitle>
|
|
|
|
- <DialogContent>{children}</DialogContent>
|
|
|
|
- {showActions && (
|
|
|
|
- <DialogActions className={classes.actions}>
|
|
|
|
- <div>{leftActions}</div>
|
|
|
|
- <div>
|
|
|
|
- {showCancel && (
|
|
|
|
- <CustomButton onClick={onCancel} color="default" name="cancel">
|
|
|
|
- {cancel}
|
|
|
|
|
|
+ <section className={classes.wrapper}>
|
|
|
|
+ <div className={`${classes.dialog} ${classes.block}`}>
|
|
|
|
+ <CustomDialogTitle onClose={handleClose} showCloseIcon={showCloseIcon}>
|
|
|
|
+ {title}
|
|
|
|
+ </CustomDialogTitle>
|
|
|
|
+ <DialogContent>{children}</DialogContent>
|
|
|
|
+ {showActions && (
|
|
|
|
+ <DialogActions className={classes.actions}>
|
|
|
|
+ <div>{leftActions}</div>
|
|
|
|
+ <div>
|
|
|
|
+ {showCancel && (
|
|
|
|
+ <CustomButton onClick={onCancel} color="default" name="cancel">
|
|
|
|
+ {cancel}
|
|
|
|
+ </CustomButton>
|
|
|
|
+ )}
|
|
|
|
+ <CustomButton
|
|
|
|
+ variant="contained"
|
|
|
|
+ onClick={handleConfirm}
|
|
|
|
+ color="primary"
|
|
|
|
+ disabled={confirmDisabled}
|
|
|
|
+ name="confirm"
|
|
|
|
+ >
|
|
|
|
+ {confirm}
|
|
</CustomButton>
|
|
</CustomButton>
|
|
- )}
|
|
|
|
- <CustomButton
|
|
|
|
- variant="contained"
|
|
|
|
- onClick={handleConfirm}
|
|
|
|
- color="primary"
|
|
|
|
- disabled={confirmDisabled}
|
|
|
|
- name="confirm"
|
|
|
|
- >
|
|
|
|
- {confirm}
|
|
|
|
- </CustomButton>
|
|
|
|
- </div>
|
|
|
|
- </DialogActions>
|
|
|
|
- )}
|
|
|
|
- </>
|
|
|
|
|
|
+ </div>
|
|
|
|
+ </DialogActions>
|
|
|
|
+ )}
|
|
|
|
+ </div>
|
|
|
|
+ <div className={classes.block}>
|
|
|
|
+ {showCode && <CodeView wrapperClass={classes.code} />}
|
|
|
|
+ </div>
|
|
|
|
+ </section>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|