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

Warning button variant #976

Merged
merged 4 commits into from
Jul 16, 2024
Merged

Warning button variant #976

merged 4 commits into from
Jul 16, 2024

Conversation

paulrobertlloyd
Copy link
Contributor

@paulrobertlloyd paulrobertlloyd commented Jun 27, 2024

Description

On our staff facing service, we use interruption screens that warn a user before they proceed to undertake an action that is destructive and/or cannot be undone. On these pages, we use also a red warning button to further indicate that a destructive action will take place:

Screenshot of a screen asking if a user wants to delete a vaccine.

This follows a similar pattern from the GOV.UK Design System:

Warning buttons

Warning buttons are designed to make users think carefully before they use them. They only work if used very sparingly. Most services should not need one.

This PR proposes adding an equivalent --warning variant to nhsuk-button. In the corresponding Service Manual guidance for this component, we can start by using the same guidance as that used in the GOV.UK Design System.

Technical note

The SCSS for each button variant currently includes a lot of repeated properties that shouldn’t need redeclaring given each modifier inherits from the base class. That’s a separate issue, so for this PR, I’ve maintained the same implementation and redeclared properties for this variant.

Checklist

frankieroberto
frankieroberto previously approved these changes Jun 28, 2024
Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

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

Looks good to me, and this would be useful in our service too.

@anandamaryon1
Copy link
Collaborator

Thanks @paulrobertlloyd this helpful. We'll need to hold this until we can add the guidance to the design system: nhsuk/nhsuk-service-manual#1995

Should be able to use the gov.uk guidance, I don't think there's anything else specific we'd need to add/amend?

@anandamaryon1 anandamaryon1 added the blocked Work that that cannot be progressed at this moment in time label Jul 11, 2024
@frankieroberto
Copy link
Contributor

Guidance added in this PR: nhsuk/nhsuk-service-manual#1999

@anandamaryon1 I think this is un-blocked now?

@anandamaryon1
Copy link
Collaborator

Ah, one small thing, do you mind if I/we change the example button label to align with the design system documentation?
@paulrobertlloyd @frankieroberto

(It's something we want to do moving forward, to ensure both are aligned to avoid confusion).

@frankieroberto
Copy link
Contributor

@anandamaryon1 ah do you mean change from "Delete account" to "Yes, delete this vaccine"?

app/components/button/warning.njk Outdated Show resolved Hide resolved
packages/components/button/README.md Outdated Show resolved Hide resolved
anandamaryon1
anandamaryon1 previously approved these changes Jul 16, 2024
@anandamaryon1 anandamaryon1 removed the blocked Work that that cannot be progressed at this moment in time label Jul 16, 2024
frankieroberto
frankieroberto previously approved these changes Jul 16, 2024
@frankieroberto frankieroberto dismissed stale reviews from anandamaryon1 and themself via 6aecc7d July 16, 2024 14:58
@frankieroberto frankieroberto merged commit 65cacf0 into main Jul 16, 2024
2 checks passed
@frankieroberto frankieroberto deleted the warning-button branch July 16, 2024 15:10
@frankieroberto
Copy link
Contributor

Merged, thanks @paulrobertlloyd and @anandamaryon1!

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.

3 participants