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 classes to action items in the summary list component #1233

Merged
merged 1 commit into from
Mar 8, 2019

Conversation

danboscaro
Copy link
Contributor

handy for adding things like govuk-link--no-visited-state to action items

the docs look like the classes description is for the action wrapper but its listed under action items, i've rejigged the current description and added a new one for the action.item classes

@NickColley
Copy link
Contributor

@danboscaro thanks for the pull request!

From a design point of view, have you thought about when you would want to add the no visited state?

There may be some improvements we could make to the default classes on this component, or even the guidance.

That aside, this looks like a reasonable feature, we will discuss this with the team as soon as we can. 👍

@danboscaro
Copy link
Contributor Author

Hi @NickColley, our particular use case for this is...

on our service we have a set of pages that gather information on a users job.

the user then can "loop" around these pages to enter however many jobs they have.

on the check your answers page the list of jobs is played back with an index incorporated in the action link to denote which loop they went through if they need to jump back to a page and change something for that particular loop.

there is also an action to remove all details entered for a job

if for example they enter 2 jobs and on the check your answers page they update the job at index 0

then they remove the job at index 0, the job that was at index 1 becomes index 0, and the change links now show as visited even though the links they did visit relate to a different job

its a pretty edge case but we want to remove the visit state so not to cause confusion

thats where this has stemmed from anyways, but we're open to suggestions if there is a better way to handle this.

it was just an example to use this class, but there might be different classes that might be helpful for multiple action links so you could target individual links separately?

@kellylee-gds kellylee-gds removed the awaiting triage Needs triaging by team label Mar 6, 2019
@kellylee-gds kellylee-gds added this to Needs review in Design System Sprint Board via automation Mar 6, 2019
@NickColley
Copy link
Contributor

NickColley commented Mar 6, 2019

I've made a note of what you've found in the backlog so others can comment on any possible guidance improvements: alphagov/govuk-design-system-backlog#182

We've discussed this feature as a team and are happy to get this in to a future release :)

I'm going to do another review now.

@danboscaro
Copy link
Contributor Author

nice one, cheers @NickColley

Ill keep an eye on that backlog item

CHANGELOG.md Outdated Show resolved Hide resolved
@NickColley
Copy link
Contributor

I have pulled this locally and tested this macro:

Input macro code
{{ govukSummaryList({
  rows: [
    {
      key: {
        text: "Name"
      },
      value: {
        text: "Sarah Philips"
      },
      actions: {
        classes: 'govuk-!-width-one-half',
        items: [
          {
            classes: 'govuk-!-font-weight-bold',
            href: "#",
            text: "Change",
            visuallyHiddenText: "name"
          }
        ]
      }
    }
  ]
}) }}
Output HTML
<dl class="govuk-summary-list">
    <div class="govuk-summary-list__row">
      <dt class="govuk-summary-list__key">
        Name
      </dt>
      <dd class="govuk-summary-list__value">
        Sarah Philips
      </dd>
        <dd class="govuk-summary-list__actions govuk-!-width-one-half">
            <a class="govuk-link govuk-!-font-weight-bold" href="#">
                Change<span class="govuk-visually-hidden"> name</span>
            </a>
        </dd>
    </div>
</dl>
Output screenshot screen shot 2019-03-06 at 15 43 47

Copy link
Contributor

@NickColley NickColley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent to me! Thanks for this contribution.

We'll need another review from the team and once they're happy we can merge this and get it released.

It looks like you need to rebase this branch to bring it up to date, if you want me to do this for you let me know!

Design System Sprint Board automation moved this from Needs review to Ready to merge Mar 6, 2019
@danboscaro
Copy link
Contributor Author

updated...

CHANGELOG.md Outdated Show resolved Hide resolved
@NickColley
Copy link
Contributor

Nice! Thanks for doing that, ready for a second review.

Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @danboscaro 🙌

@NickColley NickColley merged commit 1d6d14f into alphagov:master Mar 8, 2019
Design System Sprint Board automation moved this from Ready to merge to Done Mar 8, 2019
@NickColley NickColley mentioned this pull request Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants