Skip to content

Commit

Permalink
Change 'rows' to 'items'
Browse files Browse the repository at this point in the history
Whilst some existing components use rows and others use items, 'items' is more generic, and is closer to the HTML tag name ("list item") and the class name (`govuk-task-list__item`).
  • Loading branch information
frankieroberto committed Aug 17, 2021
1 parent f4c9761 commit 181273d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/govuk/components/task-list/task-list.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
params:
- name: rows
- name: items
type: array
required: true
description: Array of row item objects.
description: Array of item objects.
params:
- name: classes
type: string
required: false
description: Classes to add to the row `div`
description: Classes to add to the item `div`
- name: title.text
type: string
required: true
Expand Down Expand Up @@ -56,7 +56,7 @@ examples:
- name: default
data:
idPrefix: "task-list-example"
rows:
items:
- title:
text: Section 1
href: '#'
Expand Down
18 changes: 9 additions & 9 deletions src/govuk/components/task-list/template.njk
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{% set idPrefix = params.idPrefix if params.idPrefix else "task-list" %}
<ul class="govuk-task-list">
{% for row in params.rows %}
{% if row.hint %}
{% for item in params.items %}
{% if item.hint %}
{%- set hintId = idPrefix + "-" + loop.index + "-hint" -%}
{% endif %}
{%- set statusId = idPrefix + "-" + loop.index + "-status" -%}
<li class="govuk-task-list__item">
<span class="govuk-task-list__task-name">
{% if row.href %}
<a class="govuk-link" href="{{ row.href }}" aria-describedby="{{ hintId + " " if row.hint }}{{ statusId }}">
{{ row.title.html | safe if row.title.html else row.title.text }}
{% if item.href %}
<a class="govuk-link" href="{{ item.href }}" aria-describedby="{{ hintId + " " if item.hint }}{{ statusId }}">
{{ item.title.html | safe if item.title.html else item.title.text }}
</a>
{% else %}
{{ row.title.html | safe if row.title.html else row.title.text }}
{{ item.title.html | safe if item.title.html else item.title.text }}
{% endif %}
{% if row.hint %}
{% if item.hint %}
<span id="{{ hintId }}" class="govuk-task-list__hint">
{{ row.hint.html | safe if row.hint.html else row.hint.text }}
{{ item.hint.html | safe if item.hint.html else item.hint.text }}
</span>
{% endif %}
</span>
<span id="{{ statusId }}" class="govuk-task-list__status">
{{ row.status.text }}
{{ item.status.text }}
</span>
</li>
{% endfor %}
Expand Down

0 comments on commit 181273d

Please sign in to comment.