Skip to content

Commit

Permalink
Add a legal text component
Browse files Browse the repository at this point in the history
Display the ! character inside a circle, rather than using an image for
the circle and ! icon.

Add aria-hidden to the ! character to ensure it isn't read by AT.
  • Loading branch information
gemmaleigh committed Jul 17, 2017
1 parent 2292c11 commit 1ac78a0
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/legal-text/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Legal text

Use bold text with an exclamation icon if there are legal consequences - for example, a fine or prison sentence.

## Guidance

Guidance and documentation can be found on [GOV.UK Design System](linkgoeshere).

## Demo

Legal text [demo](legal-text.html).

## Usage

Code example(s)

```
@@include('legal-text.html')
```


<!--
## Installation
```
npm install --save @govuk-frontend/component-name
```
-->
46 changes: 46 additions & 0 deletions src/components/legal-text/_legal-text.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@import "../../globals/scss/colours";
@import "../../globals/scss/font-face";
@import "../../globals/scss/media-queries";
@import "../../globals/scss/typography";
@import "../../globals/scss/utilities/visually-hidden";
@import "../../globals/scss/utilities/shapes";
@import "../../globals/scss/import-once";

@include exports("legal-text") {

.govuk-c-legal-text {
position: relative;
padding: 5px 0;

font-family: $govuk-font-stack;
@include font-smoothing;
@include govuk-core-19;
}

.govuk-c-legal-text__assistive {
@include govuk-u-visually-hidden;
}

.govuk-c-legal-text__icon {
display: inline-block;

position: absolute;
top: 50%;
left: 0;

min-width: 38px;
min-height: 35px;
margin-top: -19px; // Half the height of the 38px circle
padding-top: 3px;

font-size: 1.6em;
@include govuk-bold;
line-height: 35px;
}

.govuk-c-legal-text__text {
display: block;
margin-left: -$govuk-gutter-half;
padding-left: 65px;
}
}
7 changes: 7 additions & 0 deletions src/components/legal-text/legal-text.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="govuk-c-legal-text">
<span class="govuk-c-legal-text__icon govuk-u-circle" aria-hidden="true">!</span>
<strong class="govuk-c-legal-text__text">
<span class="govuk-c-legal-text__assistive">Warning</span>
You can be fined up to £5,000 if you don’t register.
</strong>
</div>
Binary file added src/globals/icons/icon-important.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/globals/scss/govuk-frontend.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
@import "../../components/inset-text/inset-text";
@import "../../components/site-width-container/site-width-container";
@import "../../components/grid/grid";
@import "../../components/legal-text/legal-text";

0 comments on commit 1ac78a0

Please sign in to comment.