Skip to content

Commit

Permalink
date input component
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-shaw committed Jan 31, 2024
1 parent c3a8ca8 commit 7038d2f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro govukDateInput(params) %}
{% from "govuk_frontend_jinja/components/error-message/macro.html" import govukErrorMessage -%}
{% from "govuk_frontend_jinja/components/error-message/macro.html" import govukErrorMessage %}
{% from "govuk_frontend_jinja/components/fieldset/macro.html" import govukFieldset %}
{% from "govuk_frontend_jinja/components/hint/macro.html" import govukHint %}
{% from "govuk_frontend_jinja/components/input/macro.html" import govukInput %}
Expand Down Expand Up @@ -35,7 +35,7 @@
{% set ns.describedBy = ns.describedBy + " " + hintId if ns.describedBy else hintId %}
{{ govukHint({
'id': hintId,
'classes': (params.hint.classes if params.hint and params.hint.classes),
'classes': params.hint.classes,
'attributes': params.hint.attributes,
'html': params.hint.html,
'text': params.hint.text
Expand All @@ -54,7 +54,7 @@
}) | indent(2) | trim }}
{% endif %}
<div class="govuk-date-input {%- if params.classes %} {{ params.classes }}{% endif %}"
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}
{%- if params.id %} id="{{ params.id }}"{% endif %}>
{% for item in dateInputItems %}
<div class="govuk-date-input__item">
Expand All @@ -76,7 +76,7 @@
</div>
{% endfor %}
</div>
{% endset %}
{% endset -%}

<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup and params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
{% if params.fieldset %}
Expand All @@ -97,5 +97,4 @@
{{ innerHtml | trim | safe }}
{% endif %}
</div>

{% endmacro %}

0 comments on commit 7038d2f

Please sign in to comment.