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 error summary examples, add margin to error summary #583

Merged
merged 3 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Note: We're not following semantic versioning yet, we are going to talk about th

## Unreleased

Breaking changes:

- The error summary component now has a default bottom margin
(PR [#583](https://github.com/alphagov/govuk-frontend/pull/583))

Internal:

- Update pre-release step to check for new components
Expand Down
79 changes: 79 additions & 0 deletions app/views/examples/error-summary-with-messages/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{% from "back-link/macro.njk" import govukBackLink %}
{% from "button/macro.njk" import govukButton %}
{% from "date-input/macro.njk" import govukDateInput %}
{% from "error-summary/macro.njk" import govukErrorSummary %}
{% from "input/macro.njk" import govukInput %}

{% extends "layout.njk" %}

{% block content %}

{{ govukBackLink({
"href": "/",
"text": "Back"
}) }}

<main class="govuk-o-main-wrapper">

<form action="/" method="post">

{{ govukErrorSummary({
"titleText": "Message to alert the user to a problem goes here",
"descriptionText": "Optional description of the errors and how to correct them",
"classes": "optional-extra-class",
"errorList": [
{
"text": "Descriptive link to the question with an error",
"href": "#example-error-1"
},
{
"text": "Descriptive link to the question with an error",
"href": "#example-error-1"
}
]
}) }}

<h1 class="govuk-heading-xl">Passport details</h1>

{{ govukInput({
label: {
"html": '<h3 class="govuk-heading-m govuk-!-mb-r1">Passport number</h3>',
"hintText": "For example, 502135326"
},
id: "passport-number",
name: "passport-number",
errorMessage: {
"text": "You must provide your passport number"
}
}) }}

{{ govukDateInput({
fieldset: {
legendHtml: '<h3 class="govuk-heading-m">Expiry date</h3>',
legendHintText: 'For example, 08 2014'
},
id: 'expiry',
name: 'expiry',
items:[
{
name: 'month'
},
{
name: 'year'
}
],
errorMessage: {
"text": "You must provide your expiry date"
}
})
}}

{{ govukButton({
"text": "Continue"
}) }}

</form>

</main>

{% endblock %}
67 changes: 67 additions & 0 deletions app/views/examples/error-summary-with-one-thing-per-page/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{% from "back-link/macro.njk" import govukBackLink %}
{% from "button/macro.njk" import govukButton %}
{% from "date-input/macro.njk" import govukDateInput %}
{% from "error-summary/macro.njk" import govukErrorSummary %}

{% extends "layout.njk" %}

{% block content %}

{{ govukBackLink({
"href": "/",
"text": "Back"
}) }}

<main class="govuk-o-main-wrapper">

<form action="/" method="post">

{{ govukErrorSummary({
"titleText": "Message to alert the user to a problem goes here",
"descriptionText": "Optional description of the errors and how to correct them",
"classes": "optional-extra-class",
"errorList": [
{
"text": "Descriptive link to the question with an error",
"href": "#example-error-1"
},
{
"text": "Descriptive link to the question with an error",
"href": "#example-error-1"
}
]
}) }}

{{ govukDateInput({
fieldset: {
legendHtml: '<h1 class="govuk-heading-xl">What is your date of birth?</h1>',
legendHintText: 'For example, 31 3 1980'
},
id: 'dob',
name: 'dob',
items:[
{
name: 'day'
},
{
name: 'month'
},
{
name: 'year'
}
],
errorMessage: {
text: "You must provide your date of birth"
}
})
}}

{{ govukButton({
"text": "Continue"
}) }}

</form>

</main>

{% endblock %}
1 change: 1 addition & 0 deletions src/error-summary/_error-summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.govuk-c-error-summary {
@include govuk-text-colour;
@include govuk-responsive-padding($govuk-spacing-responsive-4);
@include govuk-responsive-margin($govuk-spacing-responsive-8, "bottom");
@include govuk-focusable;

border: $govuk-border-width-mobile solid $govuk-error-colour;
Expand Down