diff options
author | Joris | 2022-06-11 16:42:33 +0200 |
---|---|---|
committer | Joris | 2022-06-11 16:42:33 +0200 |
commit | 03197b1ab992540b951fcbc6f841cfcd42a757f3 (patch) | |
tree | 2eb5277462b8dfef41e901a945f251725fb7ad8f /src/view/sequencer/block.ts | |
parent | 70c672535f36edaeaf1d63d4637830b564271c34 (diff) |
Add kick sequencer
Diffstat (limited to 'src/view/sequencer/block.ts')
-rw-r--r-- | src/view/sequencer/block.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/view/sequencer/block.ts b/src/view/sequencer/block.ts new file mode 100644 index 0000000..5776120 --- /dev/null +++ b/src/view/sequencer/block.ts @@ -0,0 +1,28 @@ +import h, { classNames } from 'lib/h' + +interface Params { + checked: boolean, + onCheck: (checked: boolean) => void +} + +export function view({ checked, onCheck }: Params) { + return h('div', + { className: classNames({ + 'g-Sequencer__Block': true, + 'g-Sequencer__Block--Checked': checked + }), + onclick: (e: Event) => { + checked = !checked + onCheck(checked) + let target = e.target as HTMLElement + if (target !== undefined) { + if (checked) { + target.classList.add('g-Sequencer__Block--Checked') + } else { + target.classList.remove('g-Sequencer__Block--Checked') + } + } + } + } + ) +} |