Skip to content

Commit

Permalink
Rename summary component parameters (#3224)
Browse files Browse the repository at this point in the history
  • Loading branch information
precious-onyenaucheya-ons authored and rmccar committed Oct 9, 2024
1 parent a1ee7e8 commit f717cec
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/components/summary/_macro-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
| Name | Type | Required | Description |
| ------------ | ----------------------- | -------- | ------------------------------------------------------------------- |
| id | string | false | The HTML `id` of the row |
| rowItems | Array`<SummaryRowItem>` | true | An array of [items for the row](#summaryrowitem) |
| items | Array`<SummaryRowItem>` | true | An array of [items for the row](#summaryrowitem) |
| title | string | false | The title for the row |
| error | boolean | false | Set to “true” display an [error](/components/error) on a row |
| errorMessage | string | false | The error message for the row |
Expand Down
20 changes: 9 additions & 11 deletions src/components/summary/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,18 @@
{% if row.errorMessage %}
<div class="ons-summary__row-title--error ons-u-fs-r">{{ row.errorMessage }}</div>
{% endif %}
{% if row.rowItems | length > 1 and row.title %}
{% if row.items | length > 1 and row.title %}
<div class="ons-summary__row-title ons-summary__row-title--no-group-title ons-u-fs-r">{{ row.title }}</div>
{% endif %}

{% for rowItem in row.rowItems %}
<div class="ons-summary__row{{ " ons-summary__row--has-values" if rowItem.valueList else "" }}"{% if rowItem.id %} id="{{ rowItem.id }}"{% endif %}>
{% for item in row.items %}
<div class="ons-summary__row{{ " ons-summary__row--has-values" if item.valueList else "" }}"{% if item.id %} id="{{ item.id }}"{% endif %}>
<dt class="ons-summary__item-title"
{% if rowItem.titleAttributes %}{% for attribute, value in (rowItem.titleAttributes.items() if rowItem.titleAttributes is mapping and rowItem.titleAttributes.items else rowItem.titleAttributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
{% if item.titleAttributes %}{% for attribute, value in (item.titleAttributes.items() if item.titleAttributes is mapping and item.titleAttributes.items else item.titleAttributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
>
{% if item.iconType %}
{% from "components/icon/_macro.njk" import onsIcon %}
<span
class="ons-summary__item-title-icon{{ ' ons-summary__item-title-icon--check' if item.iconType == 'check' else "" }}"
>
<span class="ons-summary__item-title-icon{% if item.iconType == 'check' %} ons-summary__item-title-icon--check{% endif %}">
{{-
onsIcon({
"iconType": item.iconType
Expand All @@ -59,8 +57,8 @@
</span>
{% endif %}

<div class="ons-summary__item--text{{ ' ons-summary__item-title--text' if rowItem.iconType else "" }}">
{{- rowItem.title | default(row.title) | safe -}}
<div class="ons-summary__item--text{{ ' ons-summary__item-title--text' if item.iconType else "" }}">
{{- item.title | default(row.title) | safe -}}
</div>

{# Render section status for mobile if is hub #}
Expand All @@ -70,8 +68,8 @@
</dt>
{% if item.valueList %}
<dd
class="ons-summary__values{{ ' ons-summary__values--2' if not item.actions }}"
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
class="ons-summary__values{% if not item.actions %} ons-summary__values--2{% endif %}"
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
>
{% if item.valueList | length == 1 %}
<span class="ons-summary__text">{{ item.valueList[0].text | safe }}</span>
Expand Down
16 changes: 8 additions & 8 deletions src/components/summary/example-summary-card-grouped.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"rows": [
{
"title": "Are you John Doe?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -31,7 +31,7 @@
},
{
"title": "What's your date of birth?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -50,7 +50,7 @@
},
{
"title": "What is your sex?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -74,7 +74,7 @@
"rows": [
{
"title": "What is your country of birth?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -93,7 +93,7 @@
},
{
"title": "What passports do you hold?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -117,7 +117,7 @@
"rows": [
{
"title": "Have you completed an apprenticeship?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -136,7 +136,7 @@
},
{
"title": "Have you achieved a GCSE or equivalent qualification?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand Down Expand Up @@ -280,7 +280,7 @@
"rows": [
{
"title": "What are your monthly household expenses?",
"rowItems": [
"items": [
{
"title": "Food",
"valueList": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"rows": [
{
"title": "For the period 1 May 2017 to 31 May 2017, what was the total turnover of Essential Enterprise Ltd?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand Down
16 changes: 8 additions & 8 deletions src/components/summary/example-summary-grouped.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"rows": [
{
"title": "Are you John Doe?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -32,7 +32,7 @@
},
{
"title": "What's your date of birth?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -51,7 +51,7 @@
},
{
"title": "What is your sex?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -75,7 +75,7 @@
"rows": [
{
"title": "What is your country of birth?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -94,7 +94,7 @@
},
{
"title": "What passports do you hold?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -118,7 +118,7 @@
"rows": [
{
"title": "Have you completed an apprenticeship?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -137,7 +137,7 @@
},
{
"title": "Have you achieved a GCSE or equivalent qualification?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand Down Expand Up @@ -281,7 +281,7 @@
"rows": [
{
"title": "What are your monthly household expenses?",
"rowItems": [
"items": [
{
"title": "Food",
"valueList": [
Expand Down
6 changes: 3 additions & 3 deletions src/components/summary/example-summary-household.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"rows": [
{
"title": "Joe Bloggs (You)",
"rowItems": [
"items": [
{
"iconType": "person",
"actions": [
Expand All @@ -24,7 +24,7 @@
},
{
"title": "Barry Scott",
"rowItems": [
"items": [
{
"iconType": "person",
"actions": [
Expand All @@ -44,7 +44,7 @@
},
{
"title": "Wilhelmina Susannah Clementine-Smith",
"rowItems": [
"items": [
{
"iconType": "person",
"actions": [
Expand Down
8 changes: 4 additions & 4 deletions src/components/summary/example-summary-hub-minimal.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"groups": [
{
"title": "People who live here",
"rowItems": [
"items": [
{
"iconType": "check",
"iconVisuallyHiddenText": "Section complete",
Expand All @@ -24,7 +24,7 @@
},
{
"title": "Mary Smith (You)",
"rowItems": [
"items": [
{
"iconType": "check",
"iconVisuallyHiddenText": "Section complete",
Expand All @@ -40,7 +40,7 @@
},
{
"title": "John Smith",
"rowItems": [
"items": [
{
"actions": [
{
Expand All @@ -54,7 +54,7 @@
},
{
"title": "Billy Smith",
"rowItems": [
"items": [
{
"actions": [
{
Expand Down
16 changes: 8 additions & 8 deletions src/components/summary/example-summary-hub.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"groups": [
{
"title": "People who live here",
"rowItems": [
"items": [
{
"iconType": "check",
"valueList": [
Expand All @@ -28,7 +28,7 @@
},
{
"title": "Accommodation",
"rowItems": [
"items": [
{
"iconType": "check",
"valueList": [
Expand All @@ -48,7 +48,7 @@
},
{
"title": "Mary Smith (You)",
"rowItems": [
"items": [
{
"iconType": "check",
"valueList": [
Expand All @@ -68,7 +68,7 @@
},
{
"title": "John Smith",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -87,7 +87,7 @@
},
{
"title": "Billy Smith",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -106,7 +106,7 @@
},
{
"title": "Sally Smith",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -125,7 +125,7 @@
},
{
"title": "Wilhelmina Susannah Clementine-Smith (Visitor)",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -144,7 +144,7 @@
},
{
"title": "Vera Jones (Visitor)",
"rowItems": [
"items": [
{
"valueList": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/summary/example-summary-multiple.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"rows": [
{
"title": "What are your monthly household expenses?",
"rowItems": [
"items": [
{
"title": "Food",
"valueList": [
Expand Down
4 changes: 2 additions & 2 deletions src/components/summary/example-summary-no-action.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"rows": [
{
"title": "What are the dates of the sales period you are reporting for?",
"rowItems": [
"items": [
{
"valueList": [
{
Expand All @@ -21,7 +21,7 @@
},
{
"title": "Total turnover",
"rowItems": [
"items": [
{
"valueList": [
{
Expand Down
Loading

0 comments on commit f717cec

Please sign in to comment.