import React from 'react'
import './comfirm-view.scss'
import { handleConfirm, handleCancel, defaultTitle, defaultContent } from './comfirm-view.js'

function comfirmView({ show, onClose, title = defaultTitle, content = defaultContent }) {
  if (!show) {
    return null
  }

  return (
    <div className="comfirm-container">
      <div className="alert-bg">
        <div className="title">
          <label>{title}</label>
        </div>
        <div className="content">
          <label>{content}</label>
        </div>
        <div className="footer">
          <div className="cancel-button" onClick={() => handleCancel(onClose)}>取消</div>
          <div className="confirm-button" onClick={() => handleConfirm(onClose)}>确定</div>
        </div>
      </div>
    </div>
  )
}

export default comfirmView
