mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
move vendored uk components to templates
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Error message
|
||||
|
||||
## Installation
|
||||
|
||||
See the [main README quick start guide](https://github.com/alphagov/govuk-frontend#quick-start) for how to install this component.
|
||||
|
||||
## Guidance and Examples
|
||||
|
||||
Find out when to use the error message component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/error-message).
|
||||
|
||||
## Component options
|
||||
|
||||
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
||||
|
||||
See [options table](https://design-system.service.gov.uk/components/error-message/#options-example-default) for details.
|
||||
@@ -0,0 +1,15 @@
|
||||
@import "../../settings/all";
|
||||
@import "../../tools/all";
|
||||
@import "../../helpers/all";
|
||||
|
||||
@include govuk-exports("govuk/component/error-message") {
|
||||
.govuk-error-message {
|
||||
@include govuk-font($size: 19, $weight: bold);
|
||||
|
||||
display: block;
|
||||
margin-bottom: govuk-spacing(3);
|
||||
clear: both;
|
||||
|
||||
color: $govuk-error-colour;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
"name": "text",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "If `html` is set, this is not required. Text to use within the error message. If `html` is provided, the `text` argument will be ignored."
|
||||
},
|
||||
{
|
||||
"name": "html",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "If `text` is set, this is not required. HTML to use within the error message. If `html` is provided, the `text` argument will be ignored."
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"description": "Id attribute to add to the error message span tag."
|
||||
},
|
||||
{
|
||||
"name": "classes",
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"description": "Classes to add to the error message span tag."
|
||||
},
|
||||
{
|
||||
"name": "attributes",
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"description": "HTML attributes (for example data attributes) to add to the error message span tag"
|
||||
},
|
||||
{
|
||||
"name": "visuallyHiddenText",
|
||||
"type": "string",
|
||||
"description": "A visually hidden prefix used before the error message. Defaults to \"Error\"."
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
{% macro govukErrorMessage(params) %}
|
||||
{%- include "./template.njk" -%}
|
||||
{% endmacro %}
|
||||
@@ -0,0 +1,6 @@
|
||||
{% set visuallyHiddenText = params.visuallyHiddenText | default("Error") -%}
|
||||
|
||||
<span {%- if params.id %} id="{{ params.id }}"{% endif %} class="govuk-error-message{%- if params.classes %} {{ params.classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
||||
{% if visuallyHiddenText %}<span class="govuk-visually-hidden">{{ visuallyHiddenText }}:</span> {% endif -%}
|
||||
{{ params.html | safe if params.html else params.text }}
|
||||
</span>
|
||||
Reference in New Issue
Block a user