import {FC, ReactNode} from "react";
import CustomPageContainer from "@/components/custom-page-container/custom-page-container";
import {View} from "@tarojs/components";
import styles from './showModel.module.scss'

interface Props {
  show: boolean
  onClickOverlay: () => void
  children?: ReactNode
  okText?: string
  title?: string
  onOk?: () => void
}

const ShowModel: FC<Props> = (pros) => {
  return (
    <CustomPageContainer position='center' round show={pros.show} onClickOverlay={pros.onClickOverlay}>
      <View className='text-center my-3'>{pros.title}</View>
      {pros.children}
      <View className={styles.operation}>
        <View className={styles.cancel} onClick={pros.onClickOverlay}>取消</View>
        <View className={styles.cancel} onClick={pros.onOk}>{pros.okText || '确定'}</View>
      </View>
    </CustomPageContainer>
  )
}

export default ShowModel
