aboutsummaryrefslogtreecommitdiff
path: root/src/view/components/modal.ts
blob: 95f907c68dbe3823b1e598988432aca7130a31c5 (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
29
30
31
32
33
34
import { h, Html } from 'lib/rx'

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

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