Skip to content

Commit b896a8b

Browse files
authored
fix(core): spacing tweaks and new page announcement variations (#160)
* fix(core): tweak spacing and margins on several components * add captions to docs * add link styles to docs * fix(core): spacing tweaks and docs updates * fix(pagination): improve spacing * fix(core): use a consistent focus colour on all components * fix(pagination): use a more consistent focus style * fix(page-announcement): add variations to page announcement component * fix(page-announcement): spacing tweaks * update docs
1 parent 2c417bc commit b896a8b

File tree

6 files changed

+76
-26
lines changed

6 files changed

+76
-26
lines changed

Diff for: docs/components/back-link.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: Back link
33
---
44

5-
<div className="lbh-container">
6-
<a href="#" className="govuk-back-link lbh-back-link">Back to home</a>
7-
</div>
5+
import PreviewArea from "../../src/PreviewArea"
6+
7+
<PreviewArea>
8+
<a href="#" className="govuk-back-link lbh-back-link">Back to home</a>
9+
</PreviewArea>
810

911
```html
1012
<div class="lbh-container">

Diff for: docs/components/page-announcement.md

+38-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,50 @@
22
title: Page announcement
33
---
44

5+
Use a page annoucement to alert a user to important new information. Colour variations are possible for different kinds of content.
6+
7+
<section className="lbh-page-announcement">
8+
<h3 className="lbh-page-announcement__title">Payment successful</h3>
9+
<div className="lbh-page-announcement__content">
10+
More detail about the announcement.
11+
</div>
12+
</section>
13+
14+
```html
515
<section class="lbh-page-announcement">
616
<h3 class="lbh-page-announcement__title">I am a page announcement</h3>
7-
<div class="lbh-page-announcement__content"><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.</p><ul><li>I am a list lorem ipsum dolor sit amet</li><li>I am a list lorem ipsum dolor sit amet</li><li><a href="#">I am a link</a></li></ul></div>
17+
<div class="lbh-page-announcement__content">
18+
More detail about the announcement.
19+
</div>
820
</section>
21+
```
922

10-
### HTML
23+
## Warning
24+
25+
<section className="lbh-page-announcement lbh-page-announcement--warning">
26+
<h3 className="lbh-page-announcement__title">Payment unsuccessful</h3>
27+
<div className="lbh-page-announcement__content">More detail about the announcement.</div>
28+
</section>
1129

1230
```html
13-
<section class="lbh-page-announcement">
14-
<h3 class="lbh-page-announcement__title">I am a page announcement</h3>
31+
<section class="lbh-page-announcement lbh-page-announcement--warning">
32+
<h3 class="lbh-page-announcement__title">I am a warning</h3>
33+
<div class="lbh-page-announcement__content">
34+
More detail about the announcement.
35+
</div>
36+
</section>
37+
```
38+
39+
## Information
40+
41+
<section className="lbh-page-announcement lbh-page-announcement--info">
42+
<h3 className="lbh-page-announcement__title">I am information</h3>
43+
<div className="lbh-page-announcement__content"><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.</p><ul><li>I am a list lorem ipsum dolor sit amet</li><li>I am a list lorem ipsum dolor sit amet</li><li><a href="#">I am a link</a></li></ul></div>
44+
</section>
45+
46+
```html
47+
<section class="lbh-page-announcement lbh-page-announcement--info">
48+
<h3 class="lbh-page-announcement__title">I am information</h3>
1549
<div class="lbh-page-announcement__content">
1650
<p>
1751
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium

Diff for: docs/developing/react.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ One option is to call the component's init function in a [`useEffect`](https://r
2727
```jsx
2828
useEffect(() => {
2929
if (typeof window !== "undefined") {
30-
require("lbh-frontend").initAll();
30+
require("lbh-frontend").initAll()
3131
}
32-
}, []);
32+
}, [])
3333
```
3434

3535
### Server-side rendering
@@ -42,7 +42,7 @@ You can solve this issue by wrapping your component init calls in an `if` statem
4242

4343
```jsx
4444
if (typeof window !== "undefined") {
45-
require("lbh-frontend").initAll();
45+
require("lbh-frontend").initAll()
4646
}
4747
```
4848

@@ -64,3 +64,5 @@ This advice might change as the design system grows.
6464
In the past Hackney has tried to make React ports of this design system, but it's always been more trouble than it's worth to maintain them.
6565

6666
The alternative would be to go all-in with React, but this wouldn't work for the many non-React apps we still need to maintain.
67+
68+
The design system includes two components that only work with React: the [dialog](/components/dialog) and [tip](/components/tip).

Diff for: lbh/_base.scss

+4
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ $lbh-font-family: "Open Sans";
1010

1111
$govuk-asset-path: $lbh-asset-path;
1212

13+
$govuk-focus-colour: lbh-colour("lbh-primary-focus");
14+
$govuk-focus-text-colour: lbh-colour("lbh-text");
15+
$govuk-link-colour: lbh-colour("lbh-link");
16+
1317
@import "tools/all";
1418
@import "helpers/all";

Diff for: lbh/components/lbh-page-announcement/_page-announcement.scss

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@include lbh-exports("lbh/component/page-announcement") {
22
.lbh-page-announcement {
33
@include lbh-rem(margin-bottom, 36);
4-
@include lbh-rem(padding, 36, 36, 36, 24);
4+
@include lbh-rem(padding, 25, 25, 25, 25);
55
border: 1px solid lbh-colour("lbh-a03");
66
border-left: 6px solid lbh-colour("lbh-a03");
77
background: rgba(lbh-colour("lbh-a04"), 0.3);
@@ -13,6 +13,7 @@
1313

1414
&__content {
1515
@include lbh-body-m;
16+
margin-top: 0;
1617

1718
a {
1819
@include lbh-link;
@@ -24,5 +25,18 @@
2425
@include lbh-body-m;
2526
}
2627
}
28+
29+
&--warning {
30+
border: 1px solid lbh-colour("lbh-f02");
31+
border-left: 6px solid lbh-colour("lbh-f02");
32+
background: rgba(lbh-colour("lbh-f03"), 0.2);
33+
}
34+
35+
&--info {
36+
border: 1px solid lbh-colour("lbh-link");
37+
border-left: 6px solid lbh-colour("lbh-link");
38+
background: rgba(lbh-colour("lbh-link-hover"), 0.1);
39+
@include lbh-rem(padding, 36, 36, 36, 25);
40+
}
2741
}
2842
}

Diff for: lbh/components/lbh-pagination/_pagination.scss

+9-15
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
flex-direction: column;
55
@include lbh-rem(margin-top, 6);
66
@include lbh-body-m;
7+
padding: 10px 0px;
78

89
@include govuk-media-query($from: desktop) {
910
flex-direction: row;
@@ -30,41 +31,34 @@
3031
}
3132

3233
&__link {
33-
color: lbh-colour("lbh-link");
34+
@include lbh-link;
3435
padding: 0px 5px;
3536
text-decoration: none;
3637
display: inline-block;
3738

38-
&:hover {
39-
color: lbh-colour("lbh-link-hover");
40-
}
41-
42-
&:focus {
43-
outline: 3px solid lbh-colour("lbh-primary-focus");
44-
}
45-
46-
&:active {
47-
color: lbh-colour("lbh-link-active");
39+
&:visited {
40+
color: lbh-colour("lbh-link");
4841
}
4942

5043
&--current {
51-
color: lbh-colour("lbh-text");
5244
font-weight: 700;
5345
pointer-events: none;
5446
cursor: default;
5547

48+
&:link,
5649
&:hover,
57-
&:focus {
50+
&:focus,
51+
&:visited {
5852
color: lbh-colour("lbh-text");
5953
}
6054
}
6155
}
6256

6357
&__summary {
64-
margin: 10px 0px;
58+
margin-bottom: 10px;
6559
@include govuk-media-query($from: desktop) {
6660
order: 2;
67-
margin: 0px;
61+
margin-bottom: 0px;
6862
}
6963
}
7064
}

0 commit comments

Comments
 (0)