aboutsummaryrefslogtreecommitdiff
path: root/src/view/components/modal.ts
blob: fe08272681d3f3accf5b2cfb89ab53ff95ffa026 (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
import { h, Html } from 'lib/rx'

interface Params {
  content: Html,
  onClose: () => void
}

export function view({ content, onClose }: Params): Html {
  return h('div',
    { className: 'g-Modal',
      onclick: () => onClose()
    },
    h('div',
      { className: 'g-Modal__Content',
        onclick: (e: Event) => e.stopPropagation()
      },
      h('button',
        { className: 'g-Modal__Close',
          onclick: () => onClose()
        },
        '✖'
      ),
      content
    )
  )
}