src/AddRemove.ts

   1/**

   2 * # AddRemove Buttons

   3 * Adds `+` and `-` buttons to add or remove items from a list.

   4 * 

   5 * ### Profile

   6 * invoked as 

   7 * ```

   8 *  m('div', [

   9 *      m('div''main content row'),

  10 *      m(AddButton, { onclick: })

  11 *  ]),

  12 * ```

  13 * 

  14 * ### Attributes (node.attrs):

  15 * - `onclick`: function to call when button is pressed 

  16 */

  17

  18 /** */

  19import { m, Vnode}      from 'hslayout';

  20

  21export class AddButton {

  22    view(node:Vnode):Vnode {

  23        return m('.hs-add-button', { onclick:node.attrs.onclick }, '');

  24    }

  25}

  26

  27export class RemoveButton {

  28    view(node:Vnode):Vnode {

  29        return m('.hs-remove-button', { onclick:node.attrs.onclick }, '');

  30    }

  31}