// 核心库
import React from 'react'
import PropTypes from 'prop-types'
// 样式
import styles from './permissionDenyPage.css'

function PermissionDenyPage (props) {
  const { permission } = props
  return (
    <div className={styles.pageWrap}>
      <div className={styles.imgWrap} style={{ display: permission ? 'none' : 'block' }}>
        <img className={styles.img} src={require('../../assets/no-permission.png')} alt='无权限' />
      </div>
      <div className={styles.pageWrap} style={{ display: permission ? 'block' : 'none' }}>
        {props.children}
      </div>
    </div>
  )
}

PermissionDenyPage.propTypes = {
  permission: PropTypes.bool
}

PermissionDenyPage.defaultProps = {
  permission: true
}

export default PermissionDenyPage