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

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

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

export default AlertView
