Files
notifications-admin/app/templates/components/banner.html

41 lines
1.4 KiB
HTML
Raw Normal View History

{% from "components/form.html" import form_wrapper %}
2023-08-30 11:07:38 -04:00
{% from "components/components/button/macro.njk" import usaButton %}
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None, action=None, id=None, thing=None) %}
<div
class='banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}'
{% if type == 'dangerous' %}
role='group'
tabindex='-1'
{% endif %}
{% if id %}
id={{ id }}
{% endif %}
>
{% if subhead -%}
<h1 class="banner-title font-body-lg">{{ subhead }}</h1>
{%- endif -%}
{{ body }}
{% if context %}
<p class="usa-body">
{{ context }}
</p>
{% endif %}
2016-01-26 16:20:57 +00:00
{% if delete_button %}
{% call form_wrapper(action=action) %}
2016-01-26 16:20:57 +00:00
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
2023-08-30 11:07:38 -04:00
{{ usaButton({
"text": "" if thing else delete_button,
2023-06-16 14:55:24 -04:00
"html": delete_button + "<span class=\"usa-sr-only\"> " + thing + "</span>" if thing else "",
"name": "delete",
"classes": "margin-top-2 usa-button--secondary",
}) }}
{% endcall %}
2016-01-26 16:20:57 +00:00
{% endif %}
</div>
2015-12-17 14:05:35 +00:00
{% endmacro %}
{% 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) }}
{% endmacro %}