Skip to content

Commit

Permalink
Remove duplicate logic for nested macro options links
Browse files Browse the repository at this point in the history
Also fixes HTML wrapping so it’s nicely indented
  • Loading branch information
colinrotherham committed Aug 30, 2023
1 parent 6dfcb16 commit e6b9ca5
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions views/partials/_example.njk
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,16 @@
<th class="govuk-table__header" scope="row">{{ optionName | safe }}</th>
<td class="govuk-table__cell">{{ option.type }}</td>
<td class="govuk-table__cell">
{% if (option.required === true) %}
<strong>Required.</strong>
{% endif %}
{% if (option.required) %}
<strong>Required.</strong>
{% endif %}
{{ option.description | safe }}
{% if (option.isComponent) -%}
{# Create separate table data for components that are hidden in the Design System -#}
{% if ["hint", "label"].includes(option.slug) %}
See <a href="#options-{{ exampleId }}--{{ option.slug }}">{{ option.name | safe }}</a>.
{% else %}
See <a href="/components/{{ option.slug }}/#options-{{ option.slug }}-example">{{ option.name | safe }}</a>.
{% endif %}
{% endif %}
{% if (option.params) %}
See <a href="#options-{{ exampleId }}--{{ option.slug }}">{{ option.name | safe }}</a>.
{% endif -%}
{% if (option.params) or ["hint", "label"].includes(option.slug) %}
See <a href="#options-{{ exampleId }}--{{ option.slug }}">{{ option.name | safe }}</a>.
{% elif (option.isComponent) %}
{# Link to Design System component pages for nested components -#}
See <a href="/components/{{ option.slug }}/#options-{{ option.slug }}-example">{{ option.name | safe }}</a>.
{% endif %}
</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit e6b9ca5

Please sign in to comment.