2019-03-14 17:31:51 +00:00
{% from "components/form.html" import form_wrapper %}
2023-08-30 11:07:38 -04:00
{% from "components/components/button/macro.njk" import usaButton %}
2019-03-14 17:31:51 +00:00
2020-08-05 11:28:56 +01:00
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None, action=None, id=None, thing=None) %}
2017-02-13 12:11:32 +00:00
< div
2025-10-30 14:14:17 -07:00
class="usa-alert {% if type == 'dangerous' %}usa-alert--error{% else %}usa-alert--success{% endif %} banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}"
2019-10-01 17:16:15 +01:00
{% if id %}
id={{ id }}
{% endif %}
2017-02-13 12:11:32 +00:00
>
2025-10-30 14:14:17 -07:00
< div class = "usa-alert__body" >
{% if subhead -%}
< h3 class = "usa-alert__heading" > {{ subhead }}< / h3 >
{%- endif -%}
< p class = "usa-alert__text" >
{{ body }}
< / p >
{% if context %}
< p class = "usa-alert__text" >
{{ context }}
< / p >
{% endif %}
{% if delete_button %}
{% call form_wrapper(action=action) %}
< input type = "hidden" name = "csrf_token" value = "{{ csrf_token() }}" / >
{{ usaButton({
"text": "" if thing else delete_button,
"html": delete_button + "< span class = \"usa-sr-only\" > '" + thing + "'< / span > " if thing else "",
"name": "delete",
"classes": "margin-top-2 usa-button--secondary",
}) }}
{% endcall %}
{% endif %}
< / div >
2016-01-11 11:27:42 +00:00
< / div >
2015-12-17 14:05:35 +00:00
{% endmacro %}
2016-03-07 18:47:05 +00:00
2020-08-05 11:28:56 +01:00
{% macro banner_wrapper(type=None, with_tick=False, delete_button=None, subhead=None, action=None, id=None, thing=None) %}
{{ banner(caller()|safe, type=type, with_tick=with_tick, delete_button=delete_button, subhead=subhead, action=action, id=id, thing=thing) }}
2016-03-07 18:47:05 +00:00
{% endmacro %}