import { View, PageContainer, Image } from "@tarojs/components"
import style from './index.module.less'
import closeIcon from '@/images/icon-close-8.png';
interface Props {
  setShow: (show: boolean)=>void
  show: boolean,
  children?: JSX.Element|JSX.Element[]
  title?: string
}
export default ({title, show, setShow, children}:Props)=> {
  const handlePopupLeave = () => {
    setShow(false)
  }
  
  return <PageContainer
    show={show}
    round
    overlay
    overlayStyle='background-color: rgba(0, 0, 0, 0.65)'
    duration={300}
    position='bottom'
    customStyle = 'height: 100wh'
    onAfterLeave={handlePopupLeave}
    >
      <View className={style.container}>
        <View className={style.closeButton} onClick={()=>setShow(false)}>
          <Image src={closeIcon} mode="widthFix" className={style.closeIcon} />
        </View>
        <View className={style.content}>
          {children}
        </View>
      </View>
   </PageContainer>
}