{#
/**
 * @file
 * Template for Tasklist component.
 */
#}
{% set id = attributes.id|default('tasklist') %}
{% set attributes = attributes|default(create_attribute()) %}

<div {{ attributes.addClass('kern-task-list') }}>
  {% block tasklist_body %}
    {{ tasklist_body }}
    {% for task in tasklist %}
      {% if task.header is not empty %}
        {% if loop.index > 0 %}
        </ul>
        {% endif %}
        {% embed 'kern_ux_canvas:tasklist_header' with task only %}{% endembed %}
        <ul class="kern-task-list__list">
      {% elseif task.title is not empty %}
        {% set task = task|merge({id: loop.index}) %}
        {% embed 'kern_ux_canvas:tasklist_item' with task|merge({id: loop.index}) only %}{% endembed %}
      {% endif %}
      {% if loop.last %}
        </ul>
      {% endif %}
    {% endfor %}
  {% endblock %}
</div>

