import { connect } from '@tarojs/redux'
import { Block } from '@tarojs/components'

function checkDefault(props) {
  return true
}

function Visible(props) {
  const checkFn = props.check || checkDefault
  const canShow = checkFn(props)

  if (canShow) {
    return <Block>{props.children}</Block>
  }

  return null
}

export default connect(s => s.user)(Visible)
