Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary list row condition #1008

Merged
merged 4 commits into from
Sep 10, 2024
Merged

Conversation

frankieroberto
Copy link
Contributor

@frankieroberto frankieroberto commented Sep 9, 2024

This wraps all of the the HTML for a summary list row in a condition which checks whether the row object is present.

This allows inline conditions within the nunjucks macro, which can be handy for prototyping, for example:

{ summaryList({
  rows: [
    {
      key: {
        text: "Name"
      },
      value: {
        text: data.name
      }
    } if data.name,
    {
      key: {
        text: "Date of birth"
      },
      value: {
        text: data.dob
      }
    } if data.dob
  ]
}) }}

See the same feature on the GOV.UK version of summary list.

I don’t think this usually gets mentioned in documentation though.

Checklist

This wraps all of the the HTML for a summary list row in a condition which checks whether the row object is present.

This allows inline conditions within the nunjucks macro, which can be handy for prototyping.
paulrobertlloyd
paulrobertlloyd previously approved these changes Sep 9, 2024
edwardhorsford
edwardhorsford previously approved these changes Sep 9, 2024
anandamaryon1
anandamaryon1 previously approved these changes Sep 10, 2024
@frankieroberto frankieroberto merged commit 5e44a2e into main Sep 10, 2024
2 checks passed
@frankieroberto frankieroberto deleted the add-summary-list-row-condition branch September 10, 2024 10:44
edwardhorsford added a commit that referenced this pull request Sep 19, 2024
…tend into add-task-list-component

* 'add-task-list-component' of github.com:nhsuk/nhsuk-frontend: (34 commits)
  Fix encoding issue introduce in gulp v5.0 (#1013)
  Make it easier to set date values (#994)
  Update app/components/task-list/multiple-sections.njk
  Update packages/components/task-list/_task-list.scss
  Update packages/components/task-list/_task-list.scss
  Update app/components/task-list/multiple-sections.njk
  Add summary list row classes (#1007)
  Add summary list row condition (#1008)
  changelog
  backstop refs
  backstop refs
  change margins to padding
  still trying to fix linting error
  backstop refs
  remove testing markup from component examples
  backstop refs updated
  Use page template in examples
  update reference images
  tweak main wrapper margin
  reduce the padding on main wrapper on mobile
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants