import { h, Component } from 'preact'
import { Link } from 'react-router-dom'

export default class Modal extends Component {
  render() {
    if (this.props.visible) {
      document.body.classList.add("inModal")
    }
    else {
      document.body.classList.remove("inModal")
    }

    const className = this.props.visible
      ? 'modal visible'
      : 'modal'
    
    return (
      <div class={className}>
        <div class='inner'>
          {this.props.children}
        </div>
      </div>
    )
  }
}
