import React, { Component } from "react";
import { View, Button } from "@tarojs/components";
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from "taro-ui";

import "taro-ui/dist/style/components/modal.scss";

class InquiryModal extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    const { color = "black", isNo = true, isChildren = false } = this.props;
    return (
      <AtModal isOpened={this.props.isOpened}>
        <AtModalHeader>{this.props.title || "提示"}</AtModalHeader>
        <AtModalContent>
          {
            isChildren
              ? this.props.children
              : <View style={{ color: color }}>{this.props.content || ""}</View>
          }
        </AtModalContent>
        <AtModalAction>
          {isNo && <Button onClick={this.props.onClose}>取消</Button>}
          <Button onClick={this.props.onDetermine}>确定</Button>
        </AtModalAction>
      </AtModal>
    );
  }
}

export default InquiryModal;
