From 03197b1ab992540b951fcbc6f841cfcd42a757f3 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 11 Jun 2022 16:42:33 +0200 Subject: Add kick sequencer --- src/view/sequencer/addRemoveBeat.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/view/sequencer/addRemoveBeat.ts (limited to 'src/view/sequencer/addRemoveBeat.ts') diff --git a/src/view/sequencer/addRemoveBeat.ts b/src/view/sequencer/addRemoveBeat.ts new file mode 100644 index 0000000..e991d3f --- /dev/null +++ b/src/view/sequencer/addRemoveBeat.ts @@ -0,0 +1,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' + ) + ) +} -- cgit v1.2.3