modulor-js / modulor-storybook

3 stars 2 forks source link

Story as function #54

Closed nogizhopaboroda closed 6 years ago

nogizhopaboroda commented 6 years ago

This pr brings ability to write stories as functions and easy way to use modulor-html. The change is backward-compatible

example stories:


const buttonIsDisabled = true;

storiesOf('Button')
  .add('default', () => html`
     <button disabled="${buttonIsDisabled}">click me</button>
  `)

storiesOf('Button')
  .add('default', () => (container) => {
    const element = document.createElement('button');
    element.addEventListener('click', () => { ... });
    container.appendChild(element);
  })
nogizhopaboroda commented 6 years ago

@pankajpatel @nvignola could you pls check in your project?

pankajpatel commented 6 years ago

added a commit to try out example. Works out well, so added it the README as well.

nvignola commented 6 years ago

Looks good for me too

nogizhopaboroda commented 6 years ago

i'm merging then?

nvignola commented 6 years ago

Yep