fbredius/storybook

View on GitHub
examples/server-kitchen-sink/views/addons/controls/all.pug

Summary

Maintainability
Test Coverage
- nice = (nice === 'true')
- stock = parseInt(stock)
- stockMessage = stock > 0 ? `I have a stock of ${stock} ${fruit}, costing $${price} each.` : `I'm out of ${fruit}${nice ? ', Sorry!' : '.'}`;
- salutation = nice ? 'Nice to meet you!' : 'Leave me alone!';
- dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };
- style = `border: 2px dotted ${colour}; padding: 8px 22px; border-radius: 8px`;
- today = new Date(today);
- items = JSON.parse(tems);
- other = JSON.parse(other);

div(style=`${style}`)
  h1 My name is #{name},
  h3 today is #{today.toLocaleDateString('en-US', dateOptions)}
  p !{stockMessage}
  p Also, I have:
  ul 
    each item in items
      li= item
  p Other things about me: 
    ul 
      each key in Object.keys(other)
        li= `${key}: ${other[key]}`
  p #{salutation}