2023-08-30 11:07:38 -04:00
|
|
|
{% from "components/components/button/macro.njk" import usaButton %}
|
2020-02-03 12:21:39 +00:00
|
|
|
|
2016-01-14 09:44:06 +00:00
|
|
|
{% macro page_footer(
|
|
|
|
|
button_text=None,
|
2018-11-08 11:56:29 +00:00
|
|
|
button_name=None,
|
|
|
|
|
button_value=None,
|
2020-08-05 11:15:38 +01:00
|
|
|
button_text_hidden_suffix=None,
|
2016-01-14 09:44:06 +00:00
|
|
|
destructive=False,
|
2016-02-05 09:55:27 +00:00
|
|
|
secondary_link=False,
|
|
|
|
|
secondary_link_text=None,
|
2016-01-14 09:44:06 +00:00
|
|
|
delete_link=False,
|
2019-12-02 18:15:00 +00:00
|
|
|
delete_link_text="delete",
|
|
|
|
|
centered_button=False
|
2016-01-14 09:44:06 +00:00
|
|
|
) %}
|
2023-06-08 13:12:00 -04:00
|
|
|
<div class="page-footer margin-top-4">
|
2016-01-07 20:11:22 +00:00
|
|
|
{% if button_text %}
|
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
2020-02-03 12:21:39 +00:00
|
|
|
|
2023-06-08 13:12:00 -04:00
|
|
|
{% set button_data = {"text": button_text} %}
|
2020-02-03 12:21:39 +00:00
|
|
|
{% if destructive %}{% set _ = button_data.update({"classes": "govuk-button--warning page-footer__button"}) %}{% endif %}
|
|
|
|
|
{% if centered_button %}{% set _ = button_data.update({"classes": "page-footer__button--centred"}) %}{% endif %}
|
|
|
|
|
{% if button_name %}{% set _ = button_data.update({"name": button_name}) %}{% endif %}
|
|
|
|
|
{% if button_value %}{% set _ = button_data.update({"value": button_value}) %}{% endif %}
|
2020-08-05 11:15:38 +01:00
|
|
|
{% if button_text_hidden_suffix %}
|
|
|
|
|
{% set _ = button_data.update({
|
2023-06-16 14:55:24 -04:00
|
|
|
"text": "", "html": button_text + "<span class=\"usa-sr-only\"> " + button_text_hidden_suffix + "</span>"
|
2020-08-05 11:15:38 +01:00
|
|
|
}) %}
|
|
|
|
|
{% endif %}
|
2020-02-03 12:21:39 +00:00
|
|
|
|
2023-08-30 11:07:38 -04:00
|
|
|
{{ usaButton(button_data) }}
|
2020-02-03 12:21:39 +00:00
|
|
|
|
2016-01-07 20:11:22 +00:00
|
|
|
{% endif %}
|
2016-01-14 09:44:06 +00:00
|
|
|
{% if delete_link %}
|
2022-03-24 12:58:08 +00:00
|
|
|
<span class="page-footer-link {% if not button_text %}page-footer-delete-link-without-button{% endif %}">
|
2023-08-08 16:19:17 -04:00
|
|
|
<a class="usa-link usa-link--destructive" href="{{ delete_link }}">{{ delete_link_text }}</a>
|
2016-01-14 09:44:06 +00:00
|
|
|
</span>
|
|
|
|
|
{% endif %}
|
2016-02-05 09:55:27 +00:00
|
|
|
{% if secondary_link and secondary_link_text %}
|
2023-06-08 13:12:00 -04:00
|
|
|
<div class="margin-top-4">
|
|
|
|
|
<a class="usa-link font-body-sm" href="{{ secondary_link }}">{{ secondary_link_text }}</a>
|
|
|
|
|
</div>
|
2016-02-05 09:55:27 +00:00
|
|
|
{% endif %}
|
2016-01-07 20:11:22 +00:00
|
|
|
</div>
|
|
|
|
|
{% endmacro %}
|
2019-01-14 13:34:23 +00:00
|
|
|
|
|
|
|
|
{% macro sticky_page_footer(button_text=None) %}
|
|
|
|
|
<div class="js-stick-at-bottom-when-scrolling">
|
|
|
|
|
{{ page_footer(button_text) }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endmacro %}
|