{#def title="", type="info", icon="", open=True #}

{% set icons = {
  "note": "sticky_note",
  "info": "info",
  "tip": "check_circle",
  "alert": "release_alert",
  "warning": "warning",
  "danger": "release_alert",
  "error": "release_alert",
  "internal": "rocket_launch",
  "todo": "checklist",
} %}

{% if icon != False %}
  {% set icon = icon or icons.get(type) %}
{% endif %}

{% do attrs.set(class="type-" + type or "none") %}

{% if title -%}

<details {{ attrs.render(open=open, class="cd-callout", data_component="Callout") }}>
  <summary>
    {% if icon -%}
      <i class="icon">{{ icon }}</i>
    {% endif -%}
    {{ title }}
    <icon class="icon arrow">keyboard_arrow_down</icon>
  </summary>
  <div class="content">{{content}}</div>
</details>

{%- else -%}

<aside {{ attrs.render(class="cd-callout", data_component="Callout") }}>
  {% if icon -%}
  <div class="icon-wrapper">
    <i class="icon">{{ icon }}</i>
  </div>
  {%- endif %}
  <div class="content">{{content}}</div>
</aside>

{%- endif %}
