Skip to content

Commit

Permalink
Ensure date fields are only wrapped in a fieldset if there is more th…
Browse files Browse the repository at this point in the history
…an one field configured (#520)
  • Loading branch information
bameyrick authored Jul 10, 2019
1 parent cdbd88a commit 88a0142
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/date-input/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@

{% set exclusiveClass = " js-exclusive-group" if params.mutuallyExclusive else "" %}

{%- set numberOfFields = 0 -%}

{%- if params.day -%}
{%- set numberOfFields = numberOfFields + 1 -%}
{%- endif -%}

{%- if params.month -%}
{%- set numberOfFields = numberOfFields + 1 -%}
{%- endif -%}

{%- if params.year -%}
{%- set numberOfFields = numberOfFields + 1 -%}
{%- endif -%}

{% set fields %}
{% if params.label %}
<p class="u-fs-r--b u-mb-xs">{{ params.label }}</p>
Expand Down Expand Up @@ -69,7 +83,7 @@
}) %}
{{ fields | safe }}
{% endcall %}
{% elif params.noWrap %}
{% elif params.noWrap or numberOfFields == 1 %}
{{ fields | safe }}
{% else %}
{% call onsFieldset({
Expand Down

0 comments on commit 88a0142

Please sign in to comment.