@comicrelief/component-library 8.77.6 → 8.78.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/index.cjs.js +656 -596
- package/dist/index.es.js +10182 -10086
- package/package.json +1 -1
- package/src/components/Atoms/Button/Button.js +48 -6
- package/src/components/Atoms/Button/Button.style.js +46 -3
- package/src/components/Atoms/Button/Button.test.js +5 -2
- package/src/components/Atoms/Button/ButtonExample.jsx +263 -0
- package/src/components/Atoms/Icons/Cross.js +10 -3
- package/src/components/Atoms/Link/Link.style.js +2 -1
- package/src/components/Atoms/Link/Link.test.js +3 -1
- package/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +28 -28
- package/src/components/Molecules/CTA/CTAMultiCard/__snapshots__/CTAMultiCard.test.js.snap +56 -56
- package/src/components/Molecules/CTA/CTASingleCard/__snapshots__/CTASingleCard.test.js.snap +14 -14
- package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +34 -30
- package/src/components/Molecules/EmailSignUp/EmailSignUp.style.js +2 -0
- package/src/components/Molecules/HeroBanner/__snapshots__/HeroBanner.test.js.snap +56 -56
- package/src/components/Molecules/PartnerLink/PartnerLink.test.js +14 -14
- package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +34 -30
- package/src/components/Molecules/QuoteSlice/__snapshots__/QuoteSlice.test.js.snap +3 -1
- package/src/components/Molecules/SearchResult/__snapshots__/SearchResult.test.js.snap +56 -56
- package/src/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +62 -58
- package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +17 -15
- package/src/components/Organisms/CookieBanner/CookieBanner.test.js +3 -1
- package/src/components/Organisms/DonateBanner/DonateBanner.style.js +4 -1
- package/src/components/Organisms/DonateBanner/__snapshots__/DonateBanner.test.js.snap +12 -4
- package/src/components/Organisms/DynamicGallery/__snapshots__/DynamicGallery.test.js.snap +12 -4
- package/src/components/Organisms/EmailBanner/EmailBanner.style.js +0 -7
- package/src/components/Organisms/EmailBanner/__snapshots__/EmailBanner.test.js.snap +20 -36
- package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +5 -2
- package/src/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +12 -4
- package/src/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +4 -4
- package/src/components/Organisms/Membership/Membership.test.js +14 -14
- package/src/data/data.js +6 -1
- package/src/theme/crTheme/buttonColors.js +21 -4
package/package.json
CHANGED
|
@@ -1,26 +1,68 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import StyledButton from './Button.style';
|
|
3
|
+
import { StyledButton, IconWrapper, Copywrapper } from './Button.style';
|
|
4
4
|
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
5
|
+
import Picture from '../Picture/Picture';
|
|
5
6
|
|
|
6
7
|
const Button = React.forwardRef(({
|
|
7
8
|
children,
|
|
8
9
|
color = 'red',
|
|
10
|
+
icon = null,
|
|
11
|
+
iconDescription = 'Icon',
|
|
9
12
|
wrapper = false,
|
|
10
13
|
fullWidth = false,
|
|
11
14
|
buttonType = buttonTypes.PRIMARY,
|
|
12
15
|
...rest
|
|
13
|
-
}, ref) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
}, ref) => {
|
|
17
|
+
const hasIcon = Boolean(icon);
|
|
18
|
+
const hasIconPath = hasIcon && (typeof icon === 'string' || icon instanceof String);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<StyledButton
|
|
22
|
+
{...rest}
|
|
23
|
+
as={wrapper ? 'span' : 'button'}
|
|
24
|
+
ref={ref}
|
|
25
|
+
$fullWidth={fullWidth}
|
|
26
|
+
$color={color}
|
|
27
|
+
$buttonType={buttonType}
|
|
28
|
+
data-testid="Button"
|
|
29
|
+
$hasIcon={hasIcon}
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
{hasIcon
|
|
33
|
+
// Wrapping span to allow for grid positioning alongside icon
|
|
34
|
+
? <Copywrapper>{children}</Copywrapper>
|
|
35
|
+
: children
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
{hasIcon && (
|
|
39
|
+
<IconWrapper className="icon-wrapper">
|
|
40
|
+
{hasIconPath ? (
|
|
41
|
+
<Picture
|
|
42
|
+
image={icon}
|
|
43
|
+
objectFit="contain"
|
|
44
|
+
alt={iconDescription}
|
|
45
|
+
/>
|
|
46
|
+
) : (icon)}
|
|
47
|
+
</IconWrapper>
|
|
48
|
+
)}
|
|
49
|
+
|
|
50
|
+
</StyledButton>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
18
53
|
|
|
19
54
|
Button.propTypes = {
|
|
20
55
|
children: PropTypes.node.isRequired,
|
|
21
56
|
wrapper: PropTypes.bool, // Buttons as span
|
|
22
57
|
fullWidth: PropTypes.bool,
|
|
23
58
|
color: PropTypes.string,
|
|
59
|
+
icon: PropTypes.oneOfType([
|
|
60
|
+
// SVG / React component wrapping SVG code:
|
|
61
|
+
PropTypes.node,
|
|
62
|
+
// Icon URL
|
|
63
|
+
PropTypes.string
|
|
64
|
+
]),
|
|
65
|
+
iconDescription: PropTypes.string,
|
|
24
66
|
// Primary will the default for the vast majority of contexts; with
|
|
25
67
|
// Secondary and Tertirary being manually set by developers where required
|
|
26
68
|
buttonType: PropTypes.oneOf([
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import fontHelper from '../../../theme/crTheme/fontHelper';
|
|
3
3
|
|
|
4
|
+
const Copywrapper = styled.span`
|
|
5
|
+
// Purely for some cleaner markup :)
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
const IconWrapper = styled.div`
|
|
9
|
+
width: auto;
|
|
10
|
+
height: 100%;
|
|
11
|
+
margin-left: auto;
|
|
12
|
+
transition: filter 0.2s;
|
|
13
|
+
|
|
14
|
+
* {
|
|
15
|
+
width: inherit;
|
|
16
|
+
height: inherit;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
4
20
|
const StyledButton = styled.button`
|
|
21
|
+
--padding-top-and-bottom: 0.6rem;
|
|
5
22
|
display: inline-flex;
|
|
6
23
|
position: relative;
|
|
7
24
|
text-decoration: none;
|
|
8
25
|
transition: all 0.2s;
|
|
9
|
-
height:
|
|
26
|
+
height: auto;
|
|
27
|
+
min-height: 3rem;
|
|
10
28
|
width: 100%;
|
|
11
29
|
justify-content: center;
|
|
12
30
|
align-items: center;
|
|
13
31
|
border: none;
|
|
14
32
|
cursor: pointer;
|
|
15
|
-
padding:
|
|
33
|
+
padding: var(--padding-top-and-bottom) 1rem;
|
|
16
34
|
border-radius: 0.5rem;
|
|
17
35
|
|
|
18
36
|
> a {
|
|
@@ -32,6 +50,31 @@ const StyledButton = styled.button`
|
|
|
32
50
|
// place for now, just to avoid breaking anything downstream...
|
|
33
51
|
width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
|
|
34
52
|
}
|
|
53
|
+
|
|
54
|
+
${({ $hasIcon }) => $hasIcon && css`
|
|
55
|
+
display: inline-grid;
|
|
56
|
+
grid-template-columns: 1fr repeat(1, auto) 1fr;
|
|
57
|
+
grid-column-gap: 0.6rem;
|
|
58
|
+
grid-template-rows: auto;
|
|
59
|
+
justify-items: center;
|
|
60
|
+
|
|
61
|
+
> ${Copywrapper} {
|
|
62
|
+
grid-column-start: 2;
|
|
63
|
+
|
|
64
|
+
// Request from Curtis to aesthetically rebalance these smaller buttons:
|
|
65
|
+
${({ $fullWidth }) => (!$fullWidth && css`
|
|
66
|
+
padding-right: 1.5rem;
|
|
67
|
+
`)};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
> ${IconWrapper} {
|
|
71
|
+
margin-left: auto;
|
|
72
|
+
// While Button heights now scale to fit content (important for lots
|
|
73
|
+
// of copy on a small breakpoint), we so still need to constrain the
|
|
74
|
+
// icon, to prevent silliness:
|
|
75
|
+
height: calc(3rem - (var(--padding-top-and-bottom) * 2));
|
|
76
|
+
}
|
|
77
|
+
`}
|
|
35
78
|
`;
|
|
36
79
|
|
|
37
|
-
export
|
|
80
|
+
export { StyledButton, IconWrapper, Copywrapper };
|
|
@@ -10,17 +10,19 @@ it('renders a standard styled link correctly', () => {
|
|
|
10
10
|
|
|
11
11
|
expect(tree).toMatchInlineSnapshot(`
|
|
12
12
|
.c0 {
|
|
13
|
+
--padding-top-and-bottom: 0.6rem;
|
|
13
14
|
display: inline-flex;
|
|
14
15
|
position: relative;
|
|
15
16
|
text-decoration: none;
|
|
16
17
|
transition: all 0.2s;
|
|
17
|
-
height:
|
|
18
|
+
height: auto;
|
|
19
|
+
min-height: 3rem;
|
|
18
20
|
width: 100%;
|
|
19
21
|
justify-content: center;
|
|
20
22
|
align-items: center;
|
|
21
23
|
border: none;
|
|
22
24
|
cursor: pointer;
|
|
23
|
-
padding:
|
|
25
|
+
padding: var(--padding-top-and-bottom) 1rem;
|
|
24
26
|
border-radius: 0.5rem;
|
|
25
27
|
background-color: #E52630;
|
|
26
28
|
color: #FFFFFF;
|
|
@@ -41,6 +43,7 @@ it('renders a standard styled link correctly', () => {
|
|
|
41
43
|
.c0:focus-within,
|
|
42
44
|
.c0:focus-visible {
|
|
43
45
|
background-color: #890B11;
|
|
46
|
+
color: #FFFFFF;
|
|
44
47
|
outline-offset: 3px;
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -2,8 +2,41 @@ import React from 'react';
|
|
|
2
2
|
import Button from './Button';
|
|
3
3
|
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
4
4
|
import { ExampleContainer } from '../../../demos/SharedStyles';
|
|
5
|
+
import Cross from '../Icons/Cross';
|
|
6
|
+
import { ButtonIconImgPath, ButtonIconSvgPath } from '../../../data/data';
|
|
5
7
|
|
|
6
8
|
export default function ButtonExample() {
|
|
9
|
+
// Covering all of the use cases:
|
|
10
|
+
const blackCrossIcon = <Cross />;
|
|
11
|
+
const whiteCrossIcon = <Cross colour="white" />;
|
|
12
|
+
const redCrossIcon = <Cross colour="red" />;
|
|
13
|
+
|
|
14
|
+
const testImage = (
|
|
15
|
+
<img
|
|
16
|
+
src={ButtonIconImgPath}
|
|
17
|
+
alt="Test img tag"
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const testSvgImg = (
|
|
22
|
+
<img
|
|
23
|
+
src={ButtonIconSvgPath}
|
|
24
|
+
alt="Test svg in img tag"
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const whiteInlineSvg = (
|
|
29
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
+
<path d="M23.404 5.91909C23.439 5.84409 23.4635 5.76309 23.479 5.67859C23.4825 5.65859 23.4875 5.63909 23.4895 5.61909C23.4915 5.60459 23.496 5.59109 23.497 5.57659C23.503 5.49709 23.497 5.41959 23.4855 5.34359C23.483 5.32809 23.4785 5.31409 23.475 5.29859C23.456 5.20659 23.4265 5.11859 23.3835 5.03709C23.381 5.03209 23.381 5.02659 23.378 5.02159C23.377 5.02009 23.3755 5.01859 23.3745 5.01709C23.3275 4.93259 23.267 4.85759 23.198 4.79009C23.185 4.77709 23.1725 4.76459 23.159 4.75259C23.0895 4.69109 23.013 4.63909 22.928 4.59859C22.916 4.59309 22.9035 4.58909 22.8915 4.58409C22.812 4.55009 22.7275 4.52609 22.6385 4.51359C22.626 4.51159 22.6145 4.50809 22.602 4.50709C22.593 4.50609 22.585 4.50309 22.576 4.50259L3.07601 3.00259C2.67651 2.97059 2.28551 3.19009 2.10401 3.55559C1.92301 3.92059 1.98201 4.35959 2.25251 4.66409L5.35251 8.15159L1.29051 9.02209C0.881009 9.11009 0.569009 9.44409 0.509509 9.85909C0.450509 10.2741 0.656509 10.6816 1.02551 10.8801L7.10151 14.1521L8.01551 19.1786C8.08201 19.5446 8.34601 19.8431 8.70101 19.9541C8.80001 19.9851 8.90051 20.0001 9.00001 20.0001C9.26101 20.0001 9.51651 19.8976 9.70701 19.7071L23.207 6.20709C23.2175 6.19659 23.2225 6.18209 23.233 6.17109C23.294 6.10509 23.349 6.03309 23.391 5.95159C23.396 5.94109 23.399 5.93009 23.404 5.91909ZM5.39301 5.18709L15.544 5.96809L7.60051 7.67009L5.39301 5.18709ZM9.64251 16.9436L8.98401 13.3211C8.93001 13.0221 8.74201 12.7636 8.47401 12.6196L4.36751 10.4081L19.3985 7.18709L9.64251 16.9436ZM3.00101 18.0001C2.63401 18.0001 2.28101 17.7976 2.10551 17.4471C1.85851 16.9531 2.05851 16.3526 2.55301 16.1051L4.55301 15.1051C5.04801 14.8571 5.64801 15.0586 5.89501 15.5526C6.14201 16.0466 5.94201 16.6471 5.44751 16.8946L3.44751 17.8946C3.30351 17.9666 3.15101 18.0001 3.00101 18.0001ZM6.70701 18.2931C7.09751 18.6836 7.09751 19.3166 6.70701 19.7071L4.70701 21.7071C4.51151 21.9026 4.25601 22.0001 4.00001 22.0001C3.74401 22.0001 3.48851 21.9026 3.29301 21.7071C2.90251 21.3166 2.90251 20.6836 3.29301 20.2931L5.29301 18.2931C5.68351 17.9026 6.31651 17.9026 6.70701 18.2931Z" fill="#fff" />
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const blackInlineSvg = (
|
|
35
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
36
|
+
<path d="M23.404 5.91909C23.439 5.84409 23.4635 5.76309 23.479 5.67859C23.4825 5.65859 23.4875 5.63909 23.4895 5.61909C23.4915 5.60459 23.496 5.59109 23.497 5.57659C23.503 5.49709 23.497 5.41959 23.4855 5.34359C23.483 5.32809 23.4785 5.31409 23.475 5.29859C23.456 5.20659 23.4265 5.11859 23.3835 5.03709C23.381 5.03209 23.381 5.02659 23.378 5.02159C23.377 5.02009 23.3755 5.01859 23.3745 5.01709C23.3275 4.93259 23.267 4.85759 23.198 4.79009C23.185 4.77709 23.1725 4.76459 23.159 4.75259C23.0895 4.69109 23.013 4.63909 22.928 4.59859C22.916 4.59309 22.9035 4.58909 22.8915 4.58409C22.812 4.55009 22.7275 4.52609 22.6385 4.51359C22.626 4.51159 22.6145 4.50809 22.602 4.50709C22.593 4.50609 22.585 4.50309 22.576 4.50259L3.07601 3.00259C2.67651 2.97059 2.28551 3.19009 2.10401 3.55559C1.92301 3.92059 1.98201 4.35959 2.25251 4.66409L5.35251 8.15159L1.29051 9.02209C0.881009 9.11009 0.569009 9.44409 0.509509 9.85909C0.450509 10.2741 0.656509 10.6816 1.02551 10.8801L7.10151 14.1521L8.01551 19.1786C8.08201 19.5446 8.34601 19.8431 8.70101 19.9541C8.80001 19.9851 8.90051 20.0001 9.00001 20.0001C9.26101 20.0001 9.51651 19.8976 9.70701 19.7071L23.207 6.20709C23.2175 6.19659 23.2225 6.18209 23.233 6.17109C23.294 6.10509 23.349 6.03309 23.391 5.95159C23.396 5.94109 23.399 5.93009 23.404 5.91909ZM5.39301 5.18709L15.544 5.96809L7.60051 7.67009L5.39301 5.18709ZM9.64251 16.9436L8.98401 13.3211C8.93001 13.0221 8.74201 12.7636 8.47401 12.6196L4.36751 10.4081L19.3985 7.18709L9.64251 16.9436ZM3.00101 18.0001C2.63401 18.0001 2.28101 17.7976 2.10551 17.4471C1.85851 16.9531 2.05851 16.3526 2.55301 16.1051L4.55301 15.1051C5.04801 14.8571 5.64801 15.0586 5.89501 15.5526C6.14201 16.0466 5.94201 16.6471 5.44751 16.8946L3.44751 17.8946C3.30351 17.9666 3.15101 18.0001 3.00101 18.0001ZM6.70701 18.2931C7.09751 18.6836 7.09751 19.3166 6.70701 19.7071L4.70701 21.7071C4.51151 21.9026 4.25601 22.0001 4.00001 22.0001C3.74401 22.0001 3.48851 21.9026 3.29301 21.7071C2.90251 21.3166 2.90251 20.6836 3.29301 20.2931L5.29301 18.2931C5.68351 17.9026 6.31651 17.9026 6.70701 18.2931Z" fill="#222" />
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
39
|
+
|
|
7
40
|
return (
|
|
8
41
|
<>
|
|
9
42
|
<h3>Primary</h3>
|
|
@@ -100,6 +133,236 @@ export default function ButtonExample() {
|
|
|
100
133
|
<ExampleContainer>
|
|
101
134
|
<Button type="button" fullWidth>Full-width button</Button>
|
|
102
135
|
</ExampleContainer>
|
|
136
|
+
|
|
137
|
+
<ExampleContainer>
|
|
138
|
+
<Button>
|
|
139
|
+
Button with loads and loads and loads of copy
|
|
140
|
+
to illustrate new min-height sizing
|
|
141
|
+
</Button>
|
|
142
|
+
</ExampleContainer>
|
|
143
|
+
|
|
144
|
+
<br />
|
|
145
|
+
<h3>Buttons with Icons</h3>
|
|
146
|
+
|
|
147
|
+
<ExampleContainer>
|
|
148
|
+
<Button
|
|
149
|
+
type="button"
|
|
150
|
+
icon={whiteCrossIcon}
|
|
151
|
+
wrapper
|
|
152
|
+
>
|
|
153
|
+
Button with an Icon component - rendered as span
|
|
154
|
+
</Button>
|
|
155
|
+
</ExampleContainer>
|
|
156
|
+
|
|
157
|
+
<ExampleContainer>
|
|
158
|
+
<Button
|
|
159
|
+
type="button"
|
|
160
|
+
icon={ButtonIconImgPath}
|
|
161
|
+
iconDescription="House with a heart-shaped window"
|
|
162
|
+
>
|
|
163
|
+
Button w/image URL for icon
|
|
164
|
+
</Button>
|
|
165
|
+
</ExampleContainer>
|
|
166
|
+
|
|
167
|
+
<ExampleContainer>
|
|
168
|
+
<Button
|
|
169
|
+
type="button"
|
|
170
|
+
icon={testImage}
|
|
171
|
+
>
|
|
172
|
+
Button w/image tag passed in directly
|
|
173
|
+
</Button>
|
|
174
|
+
</ExampleContainer>
|
|
175
|
+
|
|
176
|
+
<ExampleContainer>
|
|
177
|
+
<Button
|
|
178
|
+
type="button"
|
|
179
|
+
icon={ButtonIconSvgPath}
|
|
180
|
+
>
|
|
181
|
+
Button w/svg URL (rendered as img) for icon
|
|
182
|
+
</Button>
|
|
183
|
+
</ExampleContainer>
|
|
184
|
+
|
|
185
|
+
<ExampleContainer>
|
|
186
|
+
<Button
|
|
187
|
+
type="button"
|
|
188
|
+
icon={whiteInlineSvg}
|
|
189
|
+
>
|
|
190
|
+
Button w/inline svg code passed directly
|
|
191
|
+
</Button>
|
|
192
|
+
</ExampleContainer>
|
|
193
|
+
|
|
194
|
+
<ExampleContainer>
|
|
195
|
+
<Button
|
|
196
|
+
type="button"
|
|
197
|
+
icon={whiteCrossIcon}
|
|
198
|
+
fullWidth
|
|
199
|
+
color="black"
|
|
200
|
+
>
|
|
201
|
+
Black full-width Button with an Icon component
|
|
202
|
+
</Button>
|
|
203
|
+
</ExampleContainer>
|
|
204
|
+
|
|
205
|
+
<ExampleContainer $bg="teal">
|
|
206
|
+
<Button
|
|
207
|
+
type="button"
|
|
208
|
+
icon={ButtonIconImgPath}
|
|
209
|
+
fullWidth
|
|
210
|
+
color="white"
|
|
211
|
+
>
|
|
212
|
+
White full-width Button w/image URL for icon
|
|
213
|
+
</Button>
|
|
214
|
+
</ExampleContainer>
|
|
215
|
+
|
|
216
|
+
<ExampleContainer>
|
|
217
|
+
<Button
|
|
218
|
+
type="button"
|
|
219
|
+
icon={testSvgImg}
|
|
220
|
+
fullWidth
|
|
221
|
+
iconDescription="Phone icon"
|
|
222
|
+
>
|
|
223
|
+
Red full-width Button w/svg URL, rendered as img
|
|
224
|
+
</Button>
|
|
225
|
+
</ExampleContainer>
|
|
226
|
+
|
|
227
|
+
<br />
|
|
228
|
+
<h3>Button variants with Icons</h3>
|
|
229
|
+
|
|
230
|
+
<h4>Primary</h4>
|
|
231
|
+
|
|
232
|
+
<ExampleContainer>
|
|
233
|
+
<Button
|
|
234
|
+
type="button"
|
|
235
|
+
icon={whiteCrossIcon}
|
|
236
|
+
>
|
|
237
|
+
Primary red button (default)
|
|
238
|
+
</Button>
|
|
239
|
+
</ExampleContainer>
|
|
240
|
+
|
|
241
|
+
<ExampleContainer>
|
|
242
|
+
<Button
|
|
243
|
+
type="button"
|
|
244
|
+
color="black"
|
|
245
|
+
icon={whiteCrossIcon}
|
|
246
|
+
>
|
|
247
|
+
Primary black button
|
|
248
|
+
</Button>
|
|
249
|
+
</ExampleContainer>
|
|
250
|
+
|
|
251
|
+
<ExampleContainer $bg="#222222">
|
|
252
|
+
<Button
|
|
253
|
+
type="button"
|
|
254
|
+
color="white"
|
|
255
|
+
icon={blackCrossIcon}
|
|
256
|
+
>
|
|
257
|
+
Primary white button
|
|
258
|
+
</Button>
|
|
259
|
+
</ExampleContainer>
|
|
260
|
+
|
|
261
|
+
<br />
|
|
262
|
+
<h4>Secondary</h4>
|
|
263
|
+
|
|
264
|
+
<ExampleContainer>
|
|
265
|
+
<Button
|
|
266
|
+
type="button"
|
|
267
|
+
buttonType={buttonTypes.SECONDARY}
|
|
268
|
+
icon={redCrossIcon}
|
|
269
|
+
>
|
|
270
|
+
Secondary red button
|
|
271
|
+
</Button>
|
|
272
|
+
</ExampleContainer>
|
|
273
|
+
|
|
274
|
+
<ExampleContainer>
|
|
275
|
+
<Button
|
|
276
|
+
type="button"
|
|
277
|
+
color="black"
|
|
278
|
+
buttonType={buttonTypes.SECONDARY}
|
|
279
|
+
icon={blackCrossIcon}
|
|
280
|
+
>
|
|
281
|
+
Secondary black button
|
|
282
|
+
</Button>
|
|
283
|
+
</ExampleContainer>
|
|
284
|
+
|
|
285
|
+
<ExampleContainer $bg="#222222">
|
|
286
|
+
<Button
|
|
287
|
+
type="button"
|
|
288
|
+
color="white"
|
|
289
|
+
buttonType={buttonTypes.SECONDARY}
|
|
290
|
+
icon={whiteCrossIcon}
|
|
291
|
+
>
|
|
292
|
+
Secondary white button
|
|
293
|
+
</Button>
|
|
294
|
+
</ExampleContainer>
|
|
295
|
+
|
|
296
|
+
<br />
|
|
297
|
+
<h4>Tertiary</h4>
|
|
298
|
+
|
|
299
|
+
<ExampleContainer>
|
|
300
|
+
<Button
|
|
301
|
+
type="button"
|
|
302
|
+
buttonType={buttonTypes.TERTIARY}
|
|
303
|
+
icon={redCrossIcon}
|
|
304
|
+
>
|
|
305
|
+
Tertiary red button
|
|
306
|
+
</Button>
|
|
307
|
+
</ExampleContainer>
|
|
308
|
+
|
|
309
|
+
<ExampleContainer>
|
|
310
|
+
<Button
|
|
311
|
+
type="button"
|
|
312
|
+
color="black"
|
|
313
|
+
buttonType={buttonTypes.TERTIARY}
|
|
314
|
+
icon={blackCrossIcon}
|
|
315
|
+
>
|
|
316
|
+
Tertiary black button
|
|
317
|
+
</Button>
|
|
318
|
+
</ExampleContainer>
|
|
319
|
+
|
|
320
|
+
<ExampleContainer $bg="#222222">
|
|
321
|
+
<Button
|
|
322
|
+
type="button"
|
|
323
|
+
color="white"
|
|
324
|
+
buttonType={buttonTypes.TERTIARY}
|
|
325
|
+
icon={whiteCrossIcon}
|
|
326
|
+
>
|
|
327
|
+
Tertiary white button
|
|
328
|
+
</Button>
|
|
329
|
+
</ExampleContainer>
|
|
330
|
+
|
|
331
|
+
<br />
|
|
332
|
+
<h4>
|
|
333
|
+
A few additional funky offerings:
|
|
334
|
+
</h4>
|
|
335
|
+
|
|
336
|
+
<ExampleContainer>
|
|
337
|
+
<Button
|
|
338
|
+
type="button"
|
|
339
|
+
color="blue_light"
|
|
340
|
+
icon={blackCrossIcon}
|
|
341
|
+
>
|
|
342
|
+
blue_light button using React component
|
|
343
|
+
</Button>
|
|
344
|
+
</ExampleContainer>
|
|
345
|
+
|
|
346
|
+
<ExampleContainer>
|
|
347
|
+
<Button
|
|
348
|
+
type="button"
|
|
349
|
+
color="yellow_light"
|
|
350
|
+
icon={blackInlineSvg}
|
|
351
|
+
>
|
|
352
|
+
yellow_light button using inline SVG code
|
|
353
|
+
</Button>
|
|
354
|
+
</ExampleContainer>
|
|
355
|
+
|
|
356
|
+
<ExampleContainer>
|
|
357
|
+
<Button
|
|
358
|
+
type="button"
|
|
359
|
+
color="teal_dark"
|
|
360
|
+
icon={whiteCrossIcon}
|
|
361
|
+
wrapper
|
|
362
|
+
>
|
|
363
|
+
teal_dark button (as span) using React component
|
|
364
|
+
</Button>
|
|
365
|
+
</ExampleContainer>
|
|
103
366
|
</>
|
|
104
367
|
);
|
|
105
368
|
}
|
|
@@ -3,7 +3,14 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import styled, { withTheme } from 'styled-components';
|
|
4
4
|
|
|
5
5
|
const Icon = styled.svg`
|
|
6
|
-
|
|
6
|
+
// Mobile-colour if available, else use standard prop
|
|
7
|
+
fill: ${({ $mobileColour, $colour, theme }) => ($mobileColour ? theme.color($mobileColour) : theme.color($colour))};
|
|
8
|
+
|
|
9
|
+
// Reinstate standard styles for 'desktop', adding a fallback for good measure:
|
|
10
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
11
|
+
fill: ${({ $colour, theme }) => ($colour ? theme.color($colour) : theme.color('white'))};
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
`;
|
|
8
15
|
|
|
9
16
|
const Cross = ({
|
|
@@ -16,8 +23,8 @@ const Cross = ({
|
|
|
16
23
|
<Icon
|
|
17
24
|
width={size}
|
|
18
25
|
height={size}
|
|
19
|
-
colour={colour}
|
|
20
|
-
mobileColour={mobileColour}
|
|
26
|
+
$colour={colour}
|
|
27
|
+
$mobileColour={mobileColour}
|
|
21
28
|
xmlns="http://www.w3.org/2000/svg"
|
|
22
29
|
viewBox="0 0 96 96"
|
|
23
30
|
{...rest}
|
|
@@ -188,7 +188,8 @@ it('renders link styled as button correctly', () => {
|
|
|
188
188
|
position: relative;
|
|
189
189
|
text-decoration: none;
|
|
190
190
|
transition: all 0.2s;
|
|
191
|
-
height:
|
|
191
|
+
height: auto;
|
|
192
|
+
min-height: 3rem;
|
|
192
193
|
width: 100%;
|
|
193
194
|
justify-content: center;
|
|
194
195
|
align-items: center;
|
|
@@ -211,6 +212,7 @@ it('renders link styled as button correctly', () => {
|
|
|
211
212
|
.c0:focus-within,
|
|
212
213
|
.c0:focus-visible {
|
|
213
214
|
background-color: #FEFD5A;
|
|
215
|
+
color: #000000;
|
|
214
216
|
outline-offset: 3px;
|
|
215
217
|
}
|
|
216
218
|
|
|
@@ -19,6 +19,20 @@ it('renders article teaser correctly', () => {
|
|
|
19
19
|
).toJSON();
|
|
20
20
|
|
|
21
21
|
expect(tree).toMatchInlineSnapshot(`
|
|
22
|
+
.c6 {
|
|
23
|
+
display: block;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
position: relative;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.c9 {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
display: block;
|
|
33
|
+
object-fit: cover;
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
.c11 {
|
|
23
37
|
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
24
38
|
font-weight: 400;
|
|
@@ -80,20 +94,6 @@ it('renders article teaser correctly', () => {
|
|
|
80
94
|
text-decoration: none;
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
.c6 {
|
|
84
|
-
display: block;
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: 100%;
|
|
87
|
-
position: relative;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.c9 {
|
|
91
|
-
width: 100%;
|
|
92
|
-
height: 100%;
|
|
93
|
-
display: block;
|
|
94
|
-
object-fit: cover;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
97
|
.c21 {
|
|
98
98
|
height: 4px;
|
|
99
99
|
width: 100%;
|
|
@@ -475,6 +475,20 @@ it('renders press realese correctly', () => {
|
|
|
475
475
|
).toJSON();
|
|
476
476
|
|
|
477
477
|
expect(tree).toMatchInlineSnapshot(`
|
|
478
|
+
.c6 {
|
|
479
|
+
display: block;
|
|
480
|
+
width: 80px;
|
|
481
|
+
height: auto;
|
|
482
|
+
position: relative;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.c9 {
|
|
486
|
+
width: 80px;
|
|
487
|
+
height: auto;
|
|
488
|
+
display: block;
|
|
489
|
+
object-fit: cover;
|
|
490
|
+
}
|
|
491
|
+
|
|
478
492
|
.c11 {
|
|
479
493
|
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
480
494
|
font-weight: 400;
|
|
@@ -536,20 +550,6 @@ it('renders press realese correctly', () => {
|
|
|
536
550
|
text-decoration: none;
|
|
537
551
|
}
|
|
538
552
|
|
|
539
|
-
.c6 {
|
|
540
|
-
display: block;
|
|
541
|
-
width: 80px;
|
|
542
|
-
height: auto;
|
|
543
|
-
position: relative;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.c9 {
|
|
547
|
-
width: 80px;
|
|
548
|
-
height: auto;
|
|
549
|
-
display: block;
|
|
550
|
-
object-fit: cover;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
553
|
.c21 {
|
|
554
554
|
height: 4px;
|
|
555
555
|
width: 100%;
|