123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import React, { Component } from 'react';
- import './index.less';
- import { Modal, Icon } from 'antd';
- import Button from '../Button';
- export default class extends Component {
- render() {
- const {
- show,
- className,
- children,
- width,
- title,
- btnAlign = 'right',
- cancelText = '取消',
- confirmText = '确定',
- onCancel,
- onConfirm,
- onClose,
- close = true,
- maskClosable = false,
- body = true,
- btnType,
- center,
- height,
- getContainer,
- } = this.props;
- return (
- <Modal
- wrapClassName={`g-modal ${className || ''}`}
- visible={show}
- closable={false}
- getContainer={getContainer}
- maskClosable={maskClosable}
- footer={false}
- width={width}
- onCancel={onClose}
- centered={center}
- >
- <div className="g-modal-wrapper">
- {close && onClose && <Icon className="close" type="close-circle" theme="filled" onClick={() => onClose()} />}
- <div className="g-modal-title">{title}</div>
- {body ? (
- <div className="g-modal-body" style={{ maxHeight: height }}>
- {children}
- </div>
- ) : (
- children
- )}
- <div className={`g-modal-btns ${btnAlign}`}>
- {onCancel && (
- <Button size="lager" theme={btnType === 'link' ? 'link t-6' : 'link'} onClick={() => onCancel()}>
- {cancelText}
- </Button>
- )}
- {onConfirm && (
- <Button size="lager" theme={btnType === 'link' ? 'link' : 'theme'} radius onClick={() => onConfirm()}>
- {confirmText}
- </Button>
- )}
- </div>
- </div>
- </Modal>
- );
- }
- }
|