aboutsummaryrefslogtreecommitdiff
path: root/src/view/sequencer/addRemoveBeat.ts
blob: e991d3fdc8dd0a0ae51b9666fb87bb9ef701ea63 (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
import h, { classNames } from 'lib/h'

interface Params {
  initBeats: number,
  onRemove: (index: number) => void,
  onAdd: (index: number) => void
}

export function view({ initBeats, onRemove, onAdd }: Params) {
  let beats = initBeats

  return h('div', { className: 'g-Sequencer__Buttons' },
    h('button', 
      { onclick: () => {
          if (beats > 1) {
            beats -= 1
            onRemove(beats)
          }
        }
      },
      'Remove Beat'
    ),
    h('button', 
      { onclick: () => {
          onAdd(beats)
          beats += 1
        }
      },
      'Add Beat'
    )
  )
}