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 task list component #425

Closed
frankieroberto opened this issue Jun 21, 2023 · 2 comments
Closed

Add task list component #425

frankieroberto opened this issue Jun 21, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@frankieroberto
Copy link
Collaborator

This is a placeholder issue where we can discuss how best to add the Task list component which has now been added to govuk-frontend but not yet released.

@frankieroberto frankieroberto added the enhancement New feature or request label Jun 21, 2023
@frankieroberto
Copy link
Collaborator Author

One complication of the task list is that the "status" can either contain raw text (or HTML) or it can contain a tag component.

The API for the nunjucks macro looks like this:

{{ govukTaskList({
  items: [
    {
      title:
        {
          text: "Company Directors"
        },
      href: "#",
      status: {
        text: "Completed"
      }
    },
    {
      title:
        {
          text: "Registered company details"
        },
      href: "#",
      status: {
        tag: {
          text: "Incomplete",
          classes: "govuk-tag--blue"
        }
      }
    }
  ]
}) }}

The ruby helper could be quite similar, but with shortcuts for setting colour?

govuk_task_list(items: [
  { 
    title: "Company details", 
    href: "#", 
    status: { text: "Completed" } 
  }, { 
    title: "Registered company details", 
    href: "#", 
    status: { tag: { text:"Completed", colour: "blue" } }
  }
])

Alternatively (or in addition?) it could support "slots" using the block syntax:

govuk_task_list do |task_list|
  task_list.with_item(title: "Company details", href: "#", status: { text: "Completed" })
  task_list.with_item(title: "Registered company details", href: "#", status: { tag: { text:"Completed", colour: "blue" })
end

Any thoughts @peteryates @paulrobertlloyd?

@peteryates
Copy link
Member

I didn't realise it had progressed this far, how exciting.

Your proposed syntax looks great to me, supporting both styles should be straightforward - the approach taken by the summary list and table works well.

github-merge-queue bot pushed a commit that referenced this issue Dec 8, 2023
Following the release of [GOV.UK Design System
v5.0](https://github.com/alphagov/govuk-design-system/milestone/16),
govuk-components v5.0.0 will be released. The headline features are:

* support for GOV.UK Design System v5.0
* inclusion of [the task list
component](alphagov/govuk-frontend#2261) #425
* all new link helpers #419
* update header to use new SVG which combines the crown and the GOV.UK
test #466

Release notes will be drafted in #469.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants