Skip to content

Commit

Permalink
Add nested options description into table caption
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Jul 7, 2023
1 parent 7147016 commit 4cd99e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/get-macro-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ function getMacroOptions (componentName) {
.map(option => ({
name: `Options for ${option.name}`,
id: option.slug,
description: option.description,
options: option.params
}))
).concat(
additionalComponents
.map(option => ({
name: `Options for ${option.name}`,
id: option.slug,
description: option.description,
options: getMacroOptionsJson(option.name)
.map(addSlugs)
.map(renderNameWithBreaks)
Expand Down
7 changes: 6 additions & 1 deletion views/partials/_example.njk
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@
</p>
{% for table in macroOptions %}
<table class="govuk-table app-options__table" id="options-{{ exampleId }}--{{ table.id }}">
<caption class="govuk-table__caption govuk-heading-m {% if table.id == 'primary' %} govuk-visually-hidden{% endif %}">{{ table.name | safe }}</caption>
<caption class="govuk-table__caption{% if table.id == 'primary' %} govuk-visually-hidden{% endif %}">
<h3 class="govuk-heading-m">{{ table.name | safe }}</h3>
{% if table.description %}
<p class="govuk-body">{{ table.description | safe }}</p>
{% endif %}
</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
Expand Down

0 comments on commit 4cd99e9

Please sign in to comment.