summaryrefslogtreecommitdiffstats
path: root/docs/theme/Callout.jinja
blob: 4279b3a45e16ffbae6a3c5309528cd08fefea888 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{#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 %}