Skip to content

Instantly share code, notes, and snippets.

@malte-wessel
Created February 14, 2017 15:02
Show Gist options
  • Save malte-wessel/ca06437ca6600900e7169f7be395f558 to your computer and use it in GitHub Desktop.
Save malte-wessel/ca06437ca6600900e7169f7be395f558 to your computer and use it in GitHub Desktop.
Type checking
{% property 'expandable' with { type: 'boolean', required: true } %}
{% property 'expanded' with { type: 'boolean', required: true } %}
{% property 'toggle' with { type: 'function' } %}
{% property 'modifier' with { type: 'string' } %}
{% property 'children' with { type: 'node', required: true } %}
{% property 'title' with { type: 'node' } %}
<div
class={{ "box box--" + modifier }}
expandable={{ expandable }}
expanded={{ expanded }}>
{% if title %}
<div class="box__title">
{{ title }}
</div>
{% endif %}
<div class="box__body">
{{ children }}
</div>
{% if expandable %}
<div class="box__footer">
<button onClick={{ toggle }}>{{ expanded ? 'less' : 'more' }}</button>
</div>
{% endif %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment