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') } } } } ) }