summaryrefslogtreecommitdiff
path: root/client/components/Modal.jsx
blob: 5738f82f2e09c7e36dca250035bcd548d0acd8cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { h, Component } from 'preact'
import { Link } from 'react-router-dom'
import { randrange } from '../util'

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'
    
    const style = 'background-color:hsl(' + randrange(330,80) + ',50%,99%)'
    
    return (
      <div class={className} style={style}>
        <div class='inner'>
          {this.props.children}
        </div>
      </div>
    )
  }
}