{#
  * @overview Macros for Lists.
  * @module Lists
  *
#}

{% from 'nightshade-core/src/links/links.macros.html' import link, link_icon %}

{#
  * Renders a List of links
  * @param {array} data - Collection of heading, links, and hrefs to populate the list
  * @param {boolean} [action_link=false] - Action link that is the last item, has an icon
  * @param {string} [action_link_icon=arrow] - Option to specify different icon for the action link
  * @param {string} [class] - Class name for style or JS targeting
  * @param {string} [id] - ID for JS targeting
#}
{% macro list(data, action_link=false, action_link_icon='arrow', class=null, id=null) %}
<div class="list{% if class %} {{ class }}{% endif %}"{% if id %} id="{{ id }}"{% endif %}>
  <h3 class="list-heading">{{ data.heading }}</h3>
  <ul class="list-items">
  {% for item in data.list %}
    {% if action_link and loop.last %}
    <li>
      {{ link_icon(item.content, href=item.href, icon=action_link_icon) }}
    </li>
    {% else %}
    <li>
      {{ link(item.content, href=item.href) }}
    </li>
    {% endif %}
  {% endfor %}
  </ul>
</div>
{% endmacro %}

{#
  * @overview Macros for Lists.
  * @module Lists
  *
#}

{% from 'nightshade-core/src/links/links.macros.html' import link, link_icon %}

{#
  * Renders a List of links
  * @param {array} data - Collection of heading, links, and hrefs to populate the list
  * @param {boolean} [action_link=false] - Action link that is the last item, has an icon
  * @param {string} [action_link_icon=arrow] - Option to specify different icon for the action link
  * @param {string} [class] - Class name for style or JS targeting
  * @param {string} [id] - ID for JS targeting
#}
{% macro list(data, action_link=false, action_link_icon='arrow', class=null, id=null) %}
<div class="list{% if class %} {{ class }}{% endif %}"{% if id %} id="{{ id }}"{% endif %}>
  {% if data.heading %}
    <h3 class="list-heading">{{ data.heading }}</h3>
  {% endif %}
  <ul class="list-items">
  {% for item in data.list %}
    {% if action_link and loop.last %}
    <li>
      {{ link_icon(item.content, href=item.href, icon=action_link_icon) }}
    </li>
    {% else %}
    <li>
      {{ link(item.content, href=item.href) }}
    </li>
    {% endif %}
  {% endfor %}
  </ul>
</div>
{% endmacro %}

Make heading optional for the list macro
Make heading optional for the list macro
