-
Notifications
You must be signed in to change notification settings - Fork 335
/
Copy pathtemplate.njk
73 lines (67 loc) · 2.74 KB
/
template.njk
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{% from "../button/macro.njk" import govukButton -%}
<div class="govuk-cookie-banner {{ params.classes if params.classes }}" data-nosnippet role="region" aria-label="{{ params.ariaLabel | default("Cookie banner") }}"
{%- if params.hidden %} hidden{% endif %}
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
{%- for message in params.messages %}
{% set classNames = "govuk-cookie-banner__message govuk-width-container" %}
{% if message.classes %}
{% set classNames = classNames + " " + message.classes %}
{% endif %}
<div class="{{classNames}}" {%- if message.role %} role="{{message.role}}"{% endif %}
{%- for attribute, value in message.attributes %} {{attribute}}="{{value}}"{% endfor %}
{% if message.hidden %} hidden{% endif %}>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{% if message.headingHtml or message.headingText %}
<h2 class="govuk-cookie-banner__heading govuk-heading-m">
{%- if message.headingHtml -%}
{{ message.headingHtml | safe }}
{%- else -%}
{{ message.headingText }}
{%- endif -%}
</h2>
{% endif %}
<div class="govuk-cookie-banner__content">
{%- if message.html -%}
{{ message.html | safe }}
{%- elif message.text -%}
<p class="govuk-body">{{ message.text }}</p>
{%- endif -%}
</div>
</div>
</div>
{% if message.actions %}
<div class="govuk-button-group">
{% for action in message.actions %}
{% if action.href %}
{% if action.type == "button" %}
{{ govukButton({
"text": action.text,
"type": "button",
"classes": action.classes,
"href": action.href,
"attributes": action.attributes
}) | indent(12) | trim }}
{% else %}
{% set linkClasses = "govuk-link" %}
{% if action.classes %}
{% set linkClasses = linkClasses + " " + action.classes %}
{% endif %}
<a class="{{ linkClasses }}" href="{{ action.href }}" {%- for attribute, value in action.attributes %} {{attribute}}="{{value}}"{% endfor %}>{{ action.text }}</a>
{% endif %}
{% else %}
{{ govukButton({
"text": action.text,
"value": action.value,
"name": action.name,
"type": action.type,
"classes": action.classes,
"attributes": action.attributes
}) | indent(12) | trim }}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
</div>