@comicrelief/component-library 8.48.2 → 8.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Atoms/Button/Button.js +15 -42
- package/dist/components/Atoms/Button/Button.md +91 -1
- package/dist/components/Atoms/Button/Button.style.js +47 -0
- package/dist/components/Atoms/Button/Button.test.js +40 -12
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +1 -1
- package/dist/components/Atoms/Link/Link.js +8 -5
- package/dist/components/Atoms/Link/Link.md +81 -78
- package/dist/components/Atoms/Link/Link.style.js +22 -18
- package/dist/components/Atoms/Link/Link.test.js +20 -19
- package/dist/components/Molecules/CardDs/CardDs.md +3 -3
- package/dist/components/Molecules/CardDs/CardDs.test.js +1 -1
- package/dist/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +43 -41
- package/dist/components/Molecules/Lookup/Lookup.js +9 -16
- package/dist/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +42 -40
- package/dist/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +42 -40
- package/dist/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +20 -19
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +21 -20
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +1 -1
- package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +41 -17
- package/dist/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +39 -12
- package/dist/components/Organisms/Header2025/Header2025.style.js +1 -1
- package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.style.js +1 -1
- package/dist/theme/crTheme/buttonColors.js +84 -72
- package/dist/theme/crTheme/buttonTypes.js +12 -0
- package/dist/theme/crTheme/colors.js +13 -1
- package/dist/theme/crTheme/fontConfig.js +3 -4
- package/dist/theme/crTheme/theme.js +2 -0
- package/package.json +1 -1
- package/playwright/components/organisms/emailSignUpForm.spec.js +1 -1
- package/src/components/Atoms/Button/Button.js +18 -36
- package/src/components/Atoms/Button/Button.md +91 -1
- package/src/components/Atoms/Button/Button.style.js +37 -0
- package/src/components/Atoms/Button/Button.test.js +44 -16
- package/src/components/Atoms/ButtonWithStates/ButtonWithStates.js +1 -1
- package/src/components/Atoms/Link/Link.js +15 -5
- package/src/components/Atoms/Link/Link.md +81 -78
- package/src/components/Atoms/Link/Link.style.js +32 -27
- package/src/components/Atoms/Link/Link.test.js +20 -19
- package/src/components/Molecules/CardDs/CardDs.md +3 -3
- package/src/components/Molecules/CardDs/CardDs.test.js +1 -1
- package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +43 -41
- package/src/components/Molecules/Lookup/Lookup.js +4 -15
- package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +42 -40
- package/src/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +42 -40
- package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +20 -19
- package/src/components/Organisms/CookieBanner/CookieBanner.test.js +21 -20
- package/src/components/Organisms/EmailSignUp/_EmailSignUp.js +1 -1
- package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +41 -17
- package/src/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +39 -12
- package/src/components/Organisms/Header2025/Header2025.style.js +2 -1
- package/src/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.style.js +1 -1
- package/src/theme/crTheme/buttonColors.js +116 -76
- package/src/theme/crTheme/buttonTypes.js +7 -0
- package/src/theme/crTheme/colors.js +14 -1
- package/src/theme/crTheme/fontConfig.js +3 -4
- package/src/theme/crTheme/theme.js +3 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import renderWithTheme from
|
|
4
|
-
import Button from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jest-styled-components';
|
|
3
|
+
import renderWithTheme from '../../../../tests/hoc/shallowWithTheme';
|
|
4
|
+
import Button from './Button';
|
|
5
5
|
|
|
6
|
-
it(
|
|
6
|
+
it('renders a standard styled link correctly', () => {
|
|
7
7
|
const tree = renderWithTheme(
|
|
8
8
|
<Button type="submit">A standard link</Button>
|
|
9
9
|
).toJSON();
|
|
@@ -15,15 +15,11 @@ it("renders a standard styled link correctly", () => {
|
|
|
15
15
|
display: -ms-inline-flexbox;
|
|
16
16
|
display: inline-flex;
|
|
17
17
|
position: relative;
|
|
18
|
-
padding: 0.5rem 1.25rem;
|
|
19
18
|
-webkit-text-decoration: none;
|
|
20
19
|
text-decoration: none;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-webkit-transition: all 0.3s;
|
|
25
|
-
transition: all 0.3s;
|
|
26
|
-
height: 3.125rem;
|
|
20
|
+
-webkit-transition: all 0.2s;
|
|
21
|
+
transition: all 0.2s;
|
|
22
|
+
min-height: 2.5rem;
|
|
27
23
|
width: 100%;
|
|
28
24
|
-webkit-box-pack: center;
|
|
29
25
|
-webkit-justify-content: center;
|
|
@@ -35,8 +31,19 @@ it("renders a standard styled link correctly", () => {
|
|
|
35
31
|
align-items: center;
|
|
36
32
|
border: none;
|
|
37
33
|
cursor: pointer;
|
|
34
|
+
padding: 0.6rem 1rem;
|
|
35
|
+
border-radius: 0.5rem;
|
|
38
36
|
background-color: #E52630;
|
|
39
37
|
color: #FFFFFF;
|
|
38
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
text-transform: inherit;
|
|
41
|
+
-webkit-letter-spacing: 0;
|
|
42
|
+
-moz-letter-spacing: 0;
|
|
43
|
+
-ms-letter-spacing: 0;
|
|
44
|
+
letter-spacing: 0;
|
|
45
|
+
font-size: 1rem;
|
|
46
|
+
line-height: 1.25rem;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
.c0 > a {
|
|
@@ -44,9 +51,31 @@ it("renders a standard styled link correctly", () => {
|
|
|
44
51
|
text-decoration: none;
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
.c0:hover
|
|
54
|
+
.c0:hover,
|
|
55
|
+
.c0:focus,
|
|
56
|
+
.c0:focus-within,
|
|
57
|
+
.c0:focus-visible {
|
|
48
58
|
background-color: #890B11;
|
|
49
|
-
|
|
59
|
+
outline-offset: 3px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.c0:disabled {
|
|
63
|
+
cursor: not-allowed;
|
|
64
|
+
opacity: 0.5;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (min-width:740px) {
|
|
68
|
+
.c0 {
|
|
69
|
+
font-size: 1rem;
|
|
70
|
+
line-height: 1.25rem;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (min-width:1024px) {
|
|
75
|
+
.c0 {
|
|
76
|
+
font-size: 1.125rem;
|
|
77
|
+
line-height: 1.375rem;
|
|
78
|
+
}
|
|
50
79
|
}
|
|
51
80
|
|
|
52
81
|
@media (min-width:740px) {
|
|
@@ -58,13 +87,12 @@ it("renders a standard styled link correctly", () => {
|
|
|
58
87
|
@media (min-width:1024px) {
|
|
59
88
|
.c0 {
|
|
60
89
|
width: auto;
|
|
61
|
-
padding: 1rem 2rem;
|
|
62
|
-
margin: 0 auto 2rem;
|
|
63
90
|
}
|
|
64
91
|
}
|
|
65
92
|
|
|
66
93
|
<button
|
|
67
94
|
className="c0"
|
|
95
|
+
color="red"
|
|
68
96
|
type="submit"
|
|
69
97
|
>
|
|
70
98
|
A standard link
|
|
@@ -4,21 +4,23 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import StyledLink, { HelperText, IconWrapper } from './Link.style';
|
|
5
5
|
import allowListed from '../../../utils/allowListed';
|
|
6
6
|
import { getDomain } from '../../../utils/internalLinkHelper';
|
|
7
|
+
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
7
8
|
|
|
8
9
|
let window = '';
|
|
9
10
|
|
|
10
11
|
const Link = ({
|
|
12
|
+
href,
|
|
11
13
|
children,
|
|
12
14
|
color = 'red',
|
|
13
|
-
mobileColour = null,
|
|
14
|
-
href,
|
|
15
|
-
target = null,
|
|
16
15
|
type = 'standard',
|
|
17
16
|
home = false,
|
|
18
17
|
underline = true,
|
|
19
|
-
icon = null,
|
|
20
18
|
iconFirst = false,
|
|
21
19
|
fullWidth = false,
|
|
20
|
+
buttonType = buttonTypes.PRIMARY,
|
|
21
|
+
target = null,
|
|
22
|
+
mobileColour = null,
|
|
23
|
+
icon = null,
|
|
22
24
|
...rest
|
|
23
25
|
}) => {
|
|
24
26
|
const [documentHost, setDocumentHost] = useState('');
|
|
@@ -64,6 +66,7 @@ const Link = ({
|
|
|
64
66
|
iconFirst={iconFirst}
|
|
65
67
|
underline={underline}
|
|
66
68
|
fullWidth={fullWidth}
|
|
69
|
+
buttonType={buttonType}
|
|
67
70
|
>
|
|
68
71
|
{children}
|
|
69
72
|
{window === '_blank' && <HelperText>(opens in new window)</HelperText>}
|
|
@@ -90,7 +93,14 @@ Link.propTypes = {
|
|
|
90
93
|
iconFirst: PropTypes.bool,
|
|
91
94
|
/** Embed icons */
|
|
92
95
|
icon: PropTypes.node,
|
|
93
|
-
fullWidth: PropTypes.bool
|
|
96
|
+
fullWidth: PropTypes.bool,
|
|
97
|
+
// Primary will the default for the vast majority of contexts; with
|
|
98
|
+
// Secondary and Tertirary being manually set by developers where required
|
|
99
|
+
buttonType: PropTypes.oneOf([
|
|
100
|
+
buttonTypes.PRIMARY,
|
|
101
|
+
buttonTypes.SECONDARY,
|
|
102
|
+
buttonTypes.TERTIARY
|
|
103
|
+
])
|
|
94
104
|
};
|
|
95
105
|
|
|
96
106
|
export default Link;
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
```js
|
|
2
2
|
import { External, Download, Favourite, Internal } from '../Icons/index';
|
|
3
|
+
|
|
3
4
|
<div>
|
|
4
|
-
<div style={{
|
|
5
|
-
<Link href="#anchor" target="blank"
|
|
5
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
6
|
+
<Link href="#anchor" target="blank">
|
|
6
7
|
Link standard
|
|
7
8
|
</Link>
|
|
8
9
|
</div>
|
|
9
|
-
<div style={{
|
|
10
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
10
11
|
<Link
|
|
11
12
|
href="#anchor"
|
|
12
13
|
target="blank"
|
|
13
|
-
type="standard"
|
|
14
14
|
icon={<Download colour="black" />}
|
|
15
15
|
>
|
|
16
16
|
Link standard icon
|
|
17
17
|
</Link>
|
|
18
18
|
</div>
|
|
19
19
|
<div
|
|
20
|
-
style={{
|
|
21
|
-
display: 'block',
|
|
22
|
-
padding: '10px',
|
|
23
|
-
marginBottom: '10px',
|
|
24
|
-
backgroundColor: '#000'
|
|
25
|
-
}}
|
|
20
|
+
style={{backgroundColor:"#000", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}
|
|
26
21
|
>
|
|
27
22
|
<Link href="#anchor" type="standard_white">
|
|
28
23
|
Link standard white
|
|
@@ -31,13 +26,78 @@ import { External, Download, Favourite, Internal } from '../Icons/index';
|
|
|
31
26
|
</div>;
|
|
32
27
|
```
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
```js
|
|
30
|
+
|
|
31
|
+
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
32
|
+
|
|
33
|
+
<div>
|
|
34
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
35
|
+
<Link color="black" href="#anchor" target="self" type="button">
|
|
36
|
+
Link as button
|
|
37
|
+
</Link>
|
|
38
|
+
</div>
|
|
39
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
40
|
+
<Link color="red" href="/test" target="self" type="button">
|
|
41
|
+
Link as button
|
|
42
|
+
</Link>
|
|
43
|
+
</div>
|
|
44
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
45
|
+
<Link color="yellow" href="/test" target="blank" type="button">
|
|
46
|
+
Link as button
|
|
47
|
+
</Link>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
52
|
+
<Link color="red" href="#anchor" target="self" type="button" buttonType={buttonTypes.SECONDARY}>
|
|
53
|
+
Link as button (secondary)
|
|
54
|
+
</Link>
|
|
55
|
+
</div>
|
|
56
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
57
|
+
<Link color="black" href="/test" target="self" type="button"buttonType={buttonTypes.SECONDARY}>
|
|
58
|
+
Link as button (secondary)
|
|
59
|
+
</Link>
|
|
60
|
+
</div>
|
|
61
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
62
|
+
<Link color="white" href="/test" target="blank" type="button" buttonType={buttonTypes.SECONDARY}>
|
|
63
|
+
Link as button (secondary)
|
|
64
|
+
</Link>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
68
|
+
<Link color="red" href="#anchor" target="self" type="button" buttonType={buttonTypes.TERTIARY}>
|
|
69
|
+
Link as button (tertiary)
|
|
70
|
+
</Link>
|
|
71
|
+
</div>
|
|
72
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
73
|
+
<Link color="black" href="/test" target="self" type="button"buttonType={buttonTypes.TERTIARY}>
|
|
74
|
+
Link as button (tertiary)
|
|
75
|
+
</Link>
|
|
76
|
+
</div>
|
|
77
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
78
|
+
<Link color="white" href="/test" target="blank" type="button" buttonType={buttonTypes.TERTIARY}>
|
|
79
|
+
Link as button (tertiary)
|
|
80
|
+
</Link>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
84
|
+
|
|
85
|
+
<div style={{ display: 'block', marginTop: '10px' }}>
|
|
86
|
+
<Link color="red" href="/test" target="blank" type="button" fullWidth>
|
|
87
|
+
Link as full-width red button
|
|
88
|
+
</Link>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
35
94
|
|
|
95
|
+
## Iconography
|
|
36
96
|
```js
|
|
37
97
|
import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from '../Icons/index';
|
|
38
98
|
|
|
39
99
|
<div>
|
|
40
|
-
<div style={{
|
|
100
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
41
101
|
<Link
|
|
42
102
|
color="red"
|
|
43
103
|
mobileColour="blue"
|
|
@@ -50,7 +110,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
50
110
|
</Link>
|
|
51
111
|
</div>
|
|
52
112
|
|
|
53
|
-
<div style={{
|
|
113
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
54
114
|
<Link
|
|
55
115
|
color="blue"
|
|
56
116
|
mobileColour="black"
|
|
@@ -63,7 +123,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
63
123
|
</Link>
|
|
64
124
|
</div>
|
|
65
125
|
|
|
66
|
-
<div style={{
|
|
126
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
67
127
|
<Link
|
|
68
128
|
color="red"
|
|
69
129
|
href="#anchor"
|
|
@@ -75,7 +135,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
75
135
|
</Link>
|
|
76
136
|
</div>
|
|
77
137
|
|
|
78
|
-
<div style={{
|
|
138
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
79
139
|
<Link
|
|
80
140
|
color="red"
|
|
81
141
|
href="#anchor"
|
|
@@ -87,7 +147,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
87
147
|
</Link>
|
|
88
148
|
</div>
|
|
89
149
|
|
|
90
|
-
<div style={{
|
|
150
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
91
151
|
<Link
|
|
92
152
|
color="red"
|
|
93
153
|
href="#anchor"
|
|
@@ -99,7 +159,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
99
159
|
</Link>
|
|
100
160
|
</div>
|
|
101
161
|
|
|
102
|
-
<div style={{
|
|
162
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
103
163
|
<Link
|
|
104
164
|
color="red"
|
|
105
165
|
href="#anchor"
|
|
@@ -111,7 +171,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
111
171
|
</Link>
|
|
112
172
|
</div>
|
|
113
173
|
|
|
114
|
-
<div style={{
|
|
174
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
115
175
|
<Link
|
|
116
176
|
color="red"
|
|
117
177
|
href="#anchor"
|
|
@@ -123,7 +183,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
123
183
|
</Link>
|
|
124
184
|
</div>
|
|
125
185
|
|
|
126
|
-
<div style={{
|
|
186
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
127
187
|
<Link
|
|
128
188
|
color="red"
|
|
129
189
|
href="#anchor"
|
|
@@ -135,7 +195,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
135
195
|
</Link>
|
|
136
196
|
</div>
|
|
137
197
|
|
|
138
|
-
<div style={{
|
|
198
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
139
199
|
<Link
|
|
140
200
|
color="red"
|
|
141
201
|
href="#anchor"
|
|
@@ -148,7 +208,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
148
208
|
</Link>
|
|
149
209
|
</div>
|
|
150
210
|
|
|
151
|
-
<div style={{
|
|
211
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
152
212
|
<Link
|
|
153
213
|
color="red"
|
|
154
214
|
href="#anchor"
|
|
@@ -161,60 +221,3 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
161
221
|
</div>
|
|
162
222
|
</div>;
|
|
163
223
|
```
|
|
164
|
-
|
|
165
|
-
```js
|
|
166
|
-
<div>
|
|
167
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
168
|
-
<Link color="black" href="#anchor" target="self" type="button">
|
|
169
|
-
Link as button
|
|
170
|
-
</Link>
|
|
171
|
-
</div>
|
|
172
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
173
|
-
<Link color="red" href="/test" target="self" type="button">
|
|
174
|
-
Link as button
|
|
175
|
-
</Link>
|
|
176
|
-
</div>
|
|
177
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
178
|
-
<Link color="yellow" href="/test" target="blank" type="button">
|
|
179
|
-
Link as button
|
|
180
|
-
</Link>
|
|
181
|
-
</div>
|
|
182
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
183
|
-
<Link color="yellow_light" href="/test" target="blank" type="button">
|
|
184
|
-
Link as button
|
|
185
|
-
</Link>
|
|
186
|
-
</div>
|
|
187
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
188
|
-
<Link color="yellow_dark" href="/test" target="blank" type="button">
|
|
189
|
-
Link as button
|
|
190
|
-
</Link>
|
|
191
|
-
</div>
|
|
192
|
-
<div
|
|
193
|
-
style={{
|
|
194
|
-
display: 'block',
|
|
195
|
-
padding: '10px',
|
|
196
|
-
marginBottom: '10px',
|
|
197
|
-
backgroundColor: '#22CFD8'
|
|
198
|
-
}}
|
|
199
|
-
>
|
|
200
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
201
|
-
<Link color="grey" href="/test" target="blank" type="button">
|
|
202
|
-
Link as button
|
|
203
|
-
</Link>
|
|
204
|
-
</div>
|
|
205
|
-
<Link color="transparent" href="/test" target="blank" type="button">
|
|
206
|
-
Link as transparent button
|
|
207
|
-
</Link>
|
|
208
|
-
<div style={{ display: 'block', marginTop: '10px' }}>
|
|
209
|
-
<Link color="white" href="/test" target="blank" type="button">
|
|
210
|
-
White button
|
|
211
|
-
</Link>
|
|
212
|
-
</div>
|
|
213
|
-
<div style={{ display: 'block', marginTop: '10px' }}>
|
|
214
|
-
<Link color="red" href="/test" target="blank" type="button" fullWidth>
|
|
215
|
-
Full-width red button
|
|
216
|
-
</Link>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
```
|
|
@@ -6,35 +6,39 @@ import fontHelper from '../../../theme/crTheme/fontHelper';
|
|
|
6
6
|
const buttonStyle = () => css`
|
|
7
7
|
display: inline-flex;
|
|
8
8
|
position: relative;
|
|
9
|
-
padding: 0.5rem 1.25rem;
|
|
10
9
|
text-decoration: none;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
transition: all 0.3s;
|
|
14
|
-
height: 3.125rem;
|
|
10
|
+
transition: all 0.2s;
|
|
11
|
+
min-height: 2.5em;
|
|
15
12
|
width: 100%;
|
|
16
13
|
justify-content: center;
|
|
17
14
|
align-items: center;
|
|
15
|
+
border: none;
|
|
18
16
|
cursor: pointer;
|
|
17
|
+
padding: 0.6rem 1rem;
|
|
18
|
+
border-radius: 0.5rem;
|
|
19
19
|
|
|
20
|
-
${({ theme }) =>
|
|
21
|
-
${fontHelper(theme, 'button')}
|
|
22
|
-
`}
|
|
20
|
+
${({ color, theme, buttonType }) => (theme.buttonColors(color, buttonType))};
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
${({ color, theme }) => (color ? theme.buttonColors(color) : theme.buttonColors('red'))};
|
|
22
|
+
${({ theme }) => css` ${fontHelper(theme, 'button')}`}
|
|
27
23
|
|
|
28
24
|
// Override with mobile-specific colours where available:
|
|
29
|
-
${({ mobileColour, theme }) => (mobileColour ? theme.buttonColors(mobileColour) : null)};
|
|
25
|
+
${({ mobileColour, theme, buttonType }) => (mobileColour ? theme.buttonColors(mobileColour, buttonType) : null)};
|
|
30
26
|
|
|
31
27
|
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
32
28
|
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
// Reinstate general styles for 'desktop':
|
|
36
31
|
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
37
|
-
|
|
32
|
+
// I don't *believe* this needs to be reinstated, but leaving in
|
|
33
|
+
// place for now, just to avoid breaking anything downstream...
|
|
34
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
35
|
+
|
|
36
|
+
// Reinstate standard colours for desktop where appropriate:
|
|
37
|
+
${({
|
|
38
|
+
mobileColour, theme, buttonType, color
|
|
39
|
+
}) => (
|
|
40
|
+
mobileColour && theme.buttonColors(color, buttonType)
|
|
41
|
+
)};
|
|
38
42
|
}
|
|
39
43
|
`;
|
|
40
44
|
|
|
@@ -51,29 +55,30 @@ export const IconWrapper = styled.span`
|
|
|
51
55
|
margin-left: ${spacing('md')};
|
|
52
56
|
align-self: center;
|
|
53
57
|
right: ${spacing('m')};
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
|
|
59
|
+
${({ type }) => type === 'standard' && css`
|
|
60
|
+
position: absolute;
|
|
61
|
+
right: -2rem;
|
|
62
|
+
top: 0;
|
|
63
|
+
bottom: 0;
|
|
64
|
+
`};
|
|
65
|
+
|
|
66
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
67
|
+
width: auto;
|
|
68
|
+
right: auto;
|
|
69
|
+
position: relative;
|
|
70
|
+
${({ type }) => type === 'standard' && css`
|
|
56
71
|
position: absolute;
|
|
57
72
|
right: -2rem;
|
|
58
73
|
top: 0;
|
|
59
74
|
bottom: 0;
|
|
60
75
|
`};
|
|
61
|
-
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
62
|
-
width: auto;
|
|
63
|
-
right: auto;
|
|
64
|
-
position: relative;
|
|
65
|
-
${({ type }) => type === 'standard'
|
|
66
|
-
&& css`
|
|
67
|
-
position: absolute;
|
|
68
|
-
right: -2rem;
|
|
69
|
-
top: 0;
|
|
70
|
-
bottom: 0;
|
|
71
|
-
`};
|
|
72
76
|
}
|
|
73
77
|
`;
|
|
74
78
|
|
|
75
79
|
const StyledLink = styled.a`
|
|
76
80
|
${props => (props.type === 'button' ? buttonStyle : linkStyle)}
|
|
81
|
+
|
|
77
82
|
${({ iconFirst }) => iconFirst
|
|
78
83
|
&& css`
|
|
79
84
|
flex-direction: row-reverse;
|
|
@@ -200,14 +200,11 @@ it('renders link styled as button correctly', () => {
|
|
|
200
200
|
display: -ms-inline-flexbox;
|
|
201
201
|
display: inline-flex;
|
|
202
202
|
position: relative;
|
|
203
|
-
padding: 0.5rem 1.25rem;
|
|
204
203
|
-webkit-text-decoration: none;
|
|
205
204
|
text-decoration: none;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
-
|
|
209
|
-
transition: all 0.3s;
|
|
210
|
-
height: 3.125rem;
|
|
205
|
+
-webkit-transition: all 0.2s;
|
|
206
|
+
transition: all 0.2s;
|
|
207
|
+
min-height: 2.5em;
|
|
211
208
|
width: 100%;
|
|
212
209
|
-webkit-box-pack: center;
|
|
213
210
|
-webkit-justify-content: center;
|
|
@@ -217,9 +214,14 @@ it('renders link styled as button correctly', () => {
|
|
|
217
214
|
-webkit-box-align: center;
|
|
218
215
|
-ms-flex-align: center;
|
|
219
216
|
align-items: center;
|
|
217
|
+
border: none;
|
|
220
218
|
cursor: pointer;
|
|
219
|
+
padding: 0.6rem 1rem;
|
|
220
|
+
border-radius: 0.5rem;
|
|
221
|
+
background-color: #FFE400;
|
|
222
|
+
color: #000000;
|
|
221
223
|
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
222
|
-
font-weight:
|
|
224
|
+
font-weight: 700;
|
|
223
225
|
text-transform: inherit;
|
|
224
226
|
-webkit-letter-spacing: 0;
|
|
225
227
|
-moz-letter-spacing: 0;
|
|
@@ -227,14 +229,19 @@ it('renders link styled as button correctly', () => {
|
|
|
227
229
|
letter-spacing: 0;
|
|
228
230
|
font-size: 1rem;
|
|
229
231
|
line-height: 1.25rem;
|
|
230
|
-
font-weight: 700;
|
|
231
|
-
background-color: #FFE400;
|
|
232
|
-
color: #000000;
|
|
233
232
|
}
|
|
234
233
|
|
|
235
|
-
.c0:hover
|
|
234
|
+
.c0:hover,
|
|
235
|
+
.c0:focus,
|
|
236
|
+
.c0:focus-within,
|
|
237
|
+
.c0:focus-visible {
|
|
236
238
|
background-color: #FEFD5A;
|
|
237
|
-
|
|
239
|
+
outline-offset: 3px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.c0:disabled {
|
|
243
|
+
cursor: not-allowed;
|
|
244
|
+
opacity: 0.5;
|
|
238
245
|
}
|
|
239
246
|
|
|
240
247
|
@media (min-width:740px) {
|
|
@@ -259,13 +266,7 @@ it('renders link styled as button correctly', () => {
|
|
|
259
266
|
|
|
260
267
|
@media (min-width:1024px) {
|
|
261
268
|
.c0 {
|
|
262
|
-
|
|
263
|
-
color: #000000;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.c0:hover {
|
|
267
|
-
background-color: #FEFD5A;
|
|
268
|
-
color: #000000;
|
|
269
|
+
width: auto;
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
272
|
|
|
@@ -18,7 +18,7 @@ import { Internal } from '../../Atoms/Icons/index';
|
|
|
18
18
|
<CardDs
|
|
19
19
|
target="_blank"
|
|
20
20
|
link="/home"
|
|
21
|
-
linkLabel="
|
|
21
|
+
linkLabel="Find out more"
|
|
22
22
|
imageLow={defaultData.image}
|
|
23
23
|
images={defaultData.images}
|
|
24
24
|
imageAltText="Happy man going to work"
|
|
@@ -66,7 +66,7 @@ import { Download } from '../../Atoms/Icons/index';
|
|
|
66
66
|
<CardDs
|
|
67
67
|
target="blank"
|
|
68
68
|
link="/home"
|
|
69
|
-
linkLabel="
|
|
69
|
+
linkLabel="Find out more"
|
|
70
70
|
backgroundColor="white"
|
|
71
71
|
height="auto"
|
|
72
72
|
icon={<Download colour="white" />}
|
|
@@ -149,7 +149,7 @@ import { Internal } from '../../Atoms/Icons/index';
|
|
|
149
149
|
<CardDs
|
|
150
150
|
target="_blank"
|
|
151
151
|
link="/home"
|
|
152
|
-
linkLabel="
|
|
152
|
+
linkLabel="Find out more"
|
|
153
153
|
imageLow={defaultData.image}
|
|
154
154
|
images={defaultData.images}
|
|
155
155
|
imageAltText="Happy man going to work"
|