1
0
Fork 0
jinjax/docs/theme/Callout.jinja
Daniel Baumann 76fe8c2886
Merging upstream version 0.46.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-05 18:42:39 +01:00

45 lines
1,019 B
Django/Jinja

{#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 %}