import React from 'react'
import { View } from '@tarojs/components'
import Overlay from '@/components/Overlay'
import './style.scss'

export default (props) => {
  const { visible, title, onClose } = props

  return (
    <Overlay visible={visible} onClose={onClose}>
      <View className='yz-modal'>
        <View className='yz-modal-header'>
          <View className='yz-modal-header-title'>{title}</View>
          <View className='yz-modal-header-action' onClick={onClose}>×</View>
        </View>
        <View className='yz-modal-body'>
          {props.children}
        </View>
      </View>
    </Overlay>
  )
}
