import React, { useState } from 'react';
import { Col, Modal, Button, Row } from '@btri-ui/base';

export default () => {
  const [show, setShow] = useState(false);
  const [show2, setShow2] = useState(false);

  const toShow = () => setShow(true);
  const toClose = () => setShow(false);

  const toShow2 = () => setShow2(true);
  const toClose2 = () => setShow2(false);

  const label =
    '默认宽度的对话框，文本内容最多不超过2行，超过2行使用最大宽度对话框。内容较少，使用小宽度的对话框。';

  return (
    <>
      <Row automode>
        <Col span={6}>
          <Button type="primary" onClick={toShow}>
            仅有标题
          </Button>
        </Col>
        <Col span={6}>
          <Button type="primary" onClick={toShow2}>
            仅有内容
          </Button>
        </Col>
      </Row>
      <Modal
        closable={false}
        title={label}
        visible={show}
        onOk={toClose}
        onCancel={toClose}
        noContent
      ></Modal>
      <Modal
        closable={false}
        visible={show2}
        onOk={toClose2}
        onCancel={toClose2}
      >
        <p>{label}</p>
      </Modal>
    </>
  );
};
