@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
|
@@ -8,161 +8,171 @@ exports.default = void 0;
|
|
|
8
8
|
var _styledComponents = require("styled-components");
|
|
9
9
|
var _colors = _interopRequireDefault(require("./colors"));
|
|
10
10
|
const buttonColors = {
|
|
11
|
+
// "Primary - red"
|
|
12
|
+
red: {
|
|
13
|
+
background: (0, _colors.default)('red'),
|
|
14
|
+
textColour: (0, _colors.default)('white'),
|
|
15
|
+
hoverBackground: (0, _colors.default)('red_dark'),
|
|
16
|
+
hovertextColour: (0, _colors.default)('white')
|
|
17
|
+
},
|
|
18
|
+
// "Primary - black"
|
|
11
19
|
black: {
|
|
12
|
-
background: (0, _colors.default)('
|
|
13
|
-
|
|
14
|
-
hoverBackground: (0, _colors.default)('
|
|
15
|
-
|
|
20
|
+
background: (0, _colors.default)('grey_dark'),
|
|
21
|
+
textColour: (0, _colors.default)('white'),
|
|
22
|
+
hoverBackground: (0, _colors.default)('black'),
|
|
23
|
+
hovertextColour: (0, _colors.default)('white')
|
|
24
|
+
},
|
|
25
|
+
// "Primary - white"
|
|
26
|
+
white: {
|
|
27
|
+
background: (0, _colors.default)('white'),
|
|
28
|
+
textColour: (0, _colors.default)('black'),
|
|
29
|
+
hoverBackground: (0, _colors.default)('grey_medium'),
|
|
30
|
+
hovertextColour: (0, _colors.default)('black')
|
|
16
31
|
},
|
|
32
|
+
// To be phased out:
|
|
17
33
|
blue: {
|
|
18
34
|
background: (0, _colors.default)('blue'),
|
|
19
|
-
|
|
35
|
+
textColour: (0, _colors.default)('white'),
|
|
20
36
|
hoverBackground: (0, _colors.default)('blue_dark'),
|
|
21
|
-
|
|
37
|
+
hovertextColour: (0, _colors.default)('white')
|
|
22
38
|
},
|
|
23
39
|
blue_dark: {
|
|
24
40
|
background: '#2042AD',
|
|
25
|
-
|
|
41
|
+
textColour: (0, _colors.default)('white'),
|
|
26
42
|
hoverBackground: (0, _colors.default)('blue_dark'),
|
|
27
|
-
|
|
43
|
+
hovertextColour: (0, _colors.default)('white')
|
|
28
44
|
},
|
|
29
45
|
blue_light: {
|
|
30
46
|
background: (0, _colors.default)('blue_light'),
|
|
31
|
-
|
|
47
|
+
textColour: (0, _colors.default)('black'),
|
|
32
48
|
hoverBackground: (0, _colors.default)('blue_dark'),
|
|
33
|
-
|
|
49
|
+
hovertextColour: (0, _colors.default)('white')
|
|
34
50
|
},
|
|
35
51
|
coral: {
|
|
36
52
|
background: (0, _colors.default)('coral'),
|
|
37
|
-
|
|
53
|
+
textColour: (0, _colors.default)('black'),
|
|
38
54
|
hoverBackground: (0, _colors.default)('coral_light'),
|
|
39
|
-
|
|
55
|
+
hovertextColour: (0, _colors.default)('black')
|
|
40
56
|
},
|
|
41
57
|
coral_dark: {
|
|
42
58
|
background: (0, _colors.default)('coral_dark'),
|
|
43
|
-
|
|
59
|
+
textColour: (0, _colors.default)('white'),
|
|
44
60
|
hoverBackground: (0, _colors.default)('coral'),
|
|
45
|
-
|
|
61
|
+
hovertextColour: (0, _colors.default)('black')
|
|
46
62
|
},
|
|
47
63
|
coral_light: {
|
|
48
64
|
background: (0, _colors.default)('coral_light'),
|
|
49
|
-
|
|
65
|
+
textColour: (0, _colors.default)('black'),
|
|
50
66
|
hoverBackground: (0, _colors.default)('coral_dark'),
|
|
51
|
-
|
|
67
|
+
hovertextColour: (0, _colors.default)('white')
|
|
52
68
|
},
|
|
53
69
|
green: {
|
|
54
70
|
background: (0, _colors.default)('green'),
|
|
55
|
-
|
|
71
|
+
textColour: (0, _colors.default)('black'),
|
|
56
72
|
hoverBackground: (0, _colors.default)('green_light'),
|
|
57
|
-
|
|
73
|
+
hovertextColour: (0, _colors.default)('black')
|
|
58
74
|
},
|
|
59
75
|
green_dark: {
|
|
60
76
|
background: (0, _colors.default)('green_dark'),
|
|
61
|
-
|
|
77
|
+
textColour: (0, _colors.default)('white'),
|
|
62
78
|
hoverBackground: (0, _colors.default)('green'),
|
|
63
|
-
|
|
79
|
+
hovertextColour: (0, _colors.default)('black')
|
|
64
80
|
},
|
|
65
81
|
green_light: {
|
|
66
82
|
background: (0, _colors.default)('green_light'),
|
|
67
|
-
|
|
83
|
+
textColour: (0, _colors.default)('black'),
|
|
68
84
|
hoverBackground: (0, _colors.default)('green_dark'),
|
|
69
|
-
|
|
85
|
+
hovertextColour: (0, _colors.default)('white')
|
|
70
86
|
},
|
|
71
87
|
grey: {
|
|
72
88
|
background: (0, _colors.default)('grey'),
|
|
73
|
-
|
|
89
|
+
textColour: (0, _colors.default)('black'),
|
|
74
90
|
hoverBackground: (0, _colors.default)('grey_light'),
|
|
75
|
-
|
|
91
|
+
hovertextColour: (0, _colors.default)('black')
|
|
76
92
|
},
|
|
77
93
|
grey_dark: {
|
|
78
94
|
background: (0, _colors.default)('grey_dark'),
|
|
79
|
-
|
|
95
|
+
textColour: (0, _colors.default)('white'),
|
|
80
96
|
hoverBackground: (0, _colors.default)('grey'),
|
|
81
|
-
|
|
97
|
+
hovertextColour: (0, _colors.default)('black')
|
|
82
98
|
},
|
|
83
99
|
grey_light: {
|
|
84
100
|
background: (0, _colors.default)('grey_light'),
|
|
85
|
-
|
|
101
|
+
textColour: (0, _colors.default)('black'),
|
|
86
102
|
hoverBackground: (0, _colors.default)('grey_dark'),
|
|
87
|
-
|
|
103
|
+
hovertextColour: (0, _colors.default)('white')
|
|
88
104
|
},
|
|
89
105
|
magenta: {
|
|
90
106
|
background: (0, _colors.default)('magenta'),
|
|
91
|
-
|
|
107
|
+
textColour: (0, _colors.default)('black'),
|
|
92
108
|
hoverBackground: (0, _colors.default)('magenta_light'),
|
|
93
|
-
|
|
109
|
+
hovertextColour: (0, _colors.default)('black')
|
|
94
110
|
},
|
|
95
111
|
magenta_dark: {
|
|
96
112
|
background: (0, _colors.default)('magenta_dark'),
|
|
97
|
-
|
|
113
|
+
textColour: (0, _colors.default)('white'),
|
|
98
114
|
hoverBackground: (0, _colors.default)('magenta'),
|
|
99
|
-
|
|
115
|
+
hovertextColour: (0, _colors.default)('black')
|
|
100
116
|
},
|
|
101
117
|
magenta_light: {
|
|
102
118
|
background: (0, _colors.default)('magenta_light'),
|
|
103
|
-
|
|
119
|
+
textColour: (0, _colors.default)('black'),
|
|
104
120
|
hoverBackground: (0, _colors.default)('magenta_dark'),
|
|
105
|
-
|
|
121
|
+
hovertextColour: (0, _colors.default)('white')
|
|
106
122
|
},
|
|
107
123
|
orange: {
|
|
108
124
|
background: (0, _colors.default)('orange'),
|
|
109
|
-
|
|
125
|
+
textColour: (0, _colors.default)('black'),
|
|
110
126
|
hoverBackground: (0, _colors.default)('orange_light'),
|
|
111
|
-
|
|
127
|
+
hovertextColour: (0, _colors.default)('black')
|
|
112
128
|
},
|
|
113
129
|
orange_dark: {
|
|
114
130
|
background: (0, _colors.default)('orange_dark'),
|
|
115
|
-
|
|
131
|
+
textColour: (0, _colors.default)('white'),
|
|
116
132
|
hoverBackground: (0, _colors.default)('orange'),
|
|
117
|
-
|
|
133
|
+
hovertextColour: (0, _colors.default)('black')
|
|
118
134
|
},
|
|
119
135
|
orange_light: {
|
|
120
136
|
background: (0, _colors.default)('orange_light'),
|
|
121
|
-
|
|
137
|
+
textColour: (0, _colors.default)('black'),
|
|
122
138
|
hoverBackground: (0, _colors.default)('orange_dark'),
|
|
123
|
-
|
|
139
|
+
hovertextColour: (0, _colors.default)('white')
|
|
124
140
|
},
|
|
125
141
|
purple: {
|
|
126
142
|
background: (0, _colors.default)('purple'),
|
|
127
|
-
|
|
143
|
+
textColour: (0, _colors.default)('white'),
|
|
128
144
|
hoverBackground: (0, _colors.default)('purple_dark'),
|
|
129
|
-
|
|
145
|
+
hovertextColour: (0, _colors.default)('white')
|
|
130
146
|
},
|
|
131
147
|
purple_dark: {
|
|
132
148
|
background: (0, _colors.default)('purple_dark'),
|
|
133
|
-
|
|
149
|
+
textColour: (0, _colors.default)('white'),
|
|
134
150
|
hoverBackground: (0, _colors.default)('purple'),
|
|
135
|
-
|
|
151
|
+
hovertextColour: (0, _colors.default)('white')
|
|
136
152
|
},
|
|
137
153
|
purple_light: {
|
|
138
154
|
background: (0, _colors.default)('purple_light'),
|
|
139
|
-
|
|
155
|
+
textColour: (0, _colors.default)('black'),
|
|
140
156
|
hoverBackground: (0, _colors.default)('purple_dark'),
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
red: {
|
|
144
|
-
background: (0, _colors.default)('red'),
|
|
145
|
-
color: (0, _colors.default)('white'),
|
|
146
|
-
hoverBackground: (0, _colors.default)('red_dark'),
|
|
147
|
-
hoverColor: (0, _colors.default)('white')
|
|
157
|
+
hovertextColour: (0, _colors.default)('white')
|
|
148
158
|
},
|
|
149
159
|
teal: {
|
|
150
160
|
background: (0, _colors.default)('teal'),
|
|
151
|
-
|
|
161
|
+
textColour: (0, _colors.default)('black'),
|
|
152
162
|
hoverBackground: (0, _colors.default)('teal_light'),
|
|
153
|
-
|
|
163
|
+
hovertextColour: (0, _colors.default)('black')
|
|
154
164
|
},
|
|
155
165
|
teal_dark: {
|
|
156
166
|
background: (0, _colors.default)('teal_dark'),
|
|
157
|
-
|
|
167
|
+
textColour: (0, _colors.default)('white'),
|
|
158
168
|
hoverBackground: (0, _colors.default)('teal'),
|
|
159
|
-
|
|
169
|
+
hovertextColour: (0, _colors.default)('black')
|
|
160
170
|
},
|
|
161
171
|
teal_light: {
|
|
162
172
|
background: (0, _colors.default)('teal_light'),
|
|
163
|
-
|
|
173
|
+
textColour: (0, _colors.default)('black'),
|
|
164
174
|
hoverBackground: (0, _colors.default)('teal_dark'),
|
|
165
|
-
|
|
175
|
+
hovertextColour: (0, _colors.default)('white')
|
|
166
176
|
},
|
|
167
177
|
transparent: {
|
|
168
178
|
background: 'rgba(255, 255, 255, 0.5)',
|
|
@@ -170,35 +180,37 @@ const buttonColors = {
|
|
|
170
180
|
hoverBackground: 'rgba(255, 255, 255, 0.7)',
|
|
171
181
|
hoverColor: 'inherit'
|
|
172
182
|
},
|
|
173
|
-
white: {
|
|
174
|
-
background: (0, _colors.default)('white'),
|
|
175
|
-
color: (0, _colors.default)('black'),
|
|
176
|
-
hoverBackground: (0, _colors.default)('grey'),
|
|
177
|
-
hoverColor: (0, _colors.default)('black')
|
|
178
|
-
},
|
|
179
183
|
yellow: {
|
|
180
184
|
background: (0, _colors.default)('yellow'),
|
|
181
|
-
|
|
185
|
+
textColour: (0, _colors.default)('black'),
|
|
182
186
|
hoverBackground: (0, _colors.default)('yellow_light'),
|
|
183
|
-
|
|
187
|
+
hovertextColour: (0, _colors.default)('black')
|
|
184
188
|
},
|
|
185
189
|
yellow_dark: {
|
|
186
190
|
background: (0, _colors.default)('yellow_dark'),
|
|
187
|
-
|
|
191
|
+
textColour: (0, _colors.default)('white'),
|
|
188
192
|
hoverBackground: (0, _colors.default)('yellow'),
|
|
189
|
-
|
|
193
|
+
hovertextColour: (0, _colors.default)('black')
|
|
190
194
|
},
|
|
191
195
|
yellow_light: {
|
|
192
196
|
background: (0, _colors.default)('yellow_light'),
|
|
193
|
-
|
|
197
|
+
textColour: (0, _colors.default)('black'),
|
|
194
198
|
hoverBackground: (0, _colors.default)('yellow_dark'),
|
|
195
|
-
|
|
199
|
+
hovertextColour: (0, _colors.default)('white')
|
|
196
200
|
}
|
|
197
201
|
};
|
|
198
|
-
var _default = colorName => {
|
|
202
|
+
var _default = (colorName, buttonType) => {
|
|
199
203
|
let style = 'inherit';
|
|
204
|
+
|
|
205
|
+
// Add a fallback, just in case someone is trying to use a non-existent colour:
|
|
206
|
+
const thisColourName = buttonColors[colorName] ? colorName : 'red';
|
|
200
207
|
if (colorName) {
|
|
201
|
-
style = (0, _styledComponents.css)(["background-color:", ";color:", "
|
|
208
|
+
style = (0, _styledComponents.css)(["background-color:", ";color:", ";&:hover,&:focus,&:focus-within,&:focus-visible{background-color:", ";color:", ";outline-offset:3px;}&:disabled{cursor:not-allowed;opacity:0.5;}", ";"], buttonColors[thisColourName].background, buttonColors[thisColourName].textColour, buttonColors[thisColourName].hoverBackground, buttonColors[thisColourName].hoverColor, _ref => {
|
|
209
|
+
let {
|
|
210
|
+
theme
|
|
211
|
+
} = _ref;
|
|
212
|
+
return (buttonType === theme.buttonTypes.SECONDARY || buttonType === theme.buttonTypes.TERTIARY) && (0, _styledComponents.css)(["background-color:transparent;color:", ";", ";&:hover,&:focus,&:focus-within,&:focus-visible{color:", ";background-color:transparent;", ";}"], buttonColors[thisColourName].background, buttonType === theme.buttonTypes.SECONDARY && (0, _styledComponents.css)(["box-shadow:0px 0px 0px 2px ", " inset;"], buttonColors[thisColourName].background), buttonColors[thisColourName].hoverBackground, buttonType === theme.buttonTypes.SECONDARY && (0, _styledComponents.css)(["box-shadow:0px 0px 0px 2px ", " inset;"], buttonColors[thisColourName].hoverBackground));
|
|
213
|
+
});
|
|
202
214
|
}
|
|
203
215
|
return style;
|
|
204
216
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const buttonTypes = {
|
|
8
|
+
PRIMARY: 'primary',
|
|
9
|
+
SECONDARY: 'secondary',
|
|
10
|
+
TERTIARY: 'tertiary'
|
|
11
|
+
};
|
|
12
|
+
var _default = exports.default = buttonTypes;
|
|
@@ -15,7 +15,7 @@ exports.default = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const colors = {
|
|
18
|
-
/* CAMPAIGN COLOURS */
|
|
18
|
+
/* RND25 CAMPAIGN COLOURS */
|
|
19
19
|
rnd_25_ruby_red: '#AE001B',
|
|
20
20
|
rnd_25_glitzy_grape: '#A20C51',
|
|
21
21
|
rnd_25_glitzy_blue: '#0F1953',
|
|
@@ -24,6 +24,18 @@ const colors = {
|
|
|
24
24
|
rnd_25_party_pink: '#FF9DEC',
|
|
25
25
|
rnd_25_party_blue: '#004EFF',
|
|
26
26
|
rnd_25_party_lilac: '#B07FEA',
|
|
27
|
+
/* RND26 CAMPAIGN COLOURS */
|
|
28
|
+
rnd_26_dark_purple: '#7953E8',
|
|
29
|
+
rnd_26_deep_indigo: '#341A7E',
|
|
30
|
+
rnd_26_light_purple: '#BA9DFC',
|
|
31
|
+
rnd_26_teal: '#036D7C',
|
|
32
|
+
rnd_26_deep_teal: '#024042',
|
|
33
|
+
rnd_26_green: '#7FFB73',
|
|
34
|
+
rnd_26_magenta: '#A7268C',
|
|
35
|
+
rnd_26_deep_magenta: '#601151',
|
|
36
|
+
rnd_26_yellow: '#F8F440',
|
|
37
|
+
rnd_26_vibrant_pink: '#E948D5',
|
|
38
|
+
rnd_26_light_pink: '#FE80EB',
|
|
27
39
|
/* GREYSCALE COLOURS */
|
|
28
40
|
black: '#000000',
|
|
29
41
|
white: '#FFFFFF',
|
|
@@ -143,10 +143,9 @@ var _default = exports.default = {
|
|
|
143
143
|
lineHeight: '1.375rem'
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
// To be used directly (not via fontHelper), but makes sense to keep here:
|
|
147
146
|
button: {
|
|
148
147
|
family: 'Montserrat',
|
|
149
|
-
weight:
|
|
148
|
+
weight: 700,
|
|
150
149
|
transform: 'inherit',
|
|
151
150
|
small: {
|
|
152
151
|
fontSize: '1rem',
|
|
@@ -161,8 +160,8 @@ var _default = exports.default = {
|
|
|
161
160
|
lineHeight: '1.375rem'
|
|
162
161
|
}
|
|
163
162
|
},
|
|
164
|
-
// Admittedly, while
|
|
165
|
-
//
|
|
163
|
+
// Admittedly, while these values are identical for each breakpoint,
|
|
164
|
+
// it still made sense to keep it here all here for parity:
|
|
166
165
|
formFieldLabel: {
|
|
167
166
|
family: 'Montserrat',
|
|
168
167
|
weight: 400,
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _colors = _interopRequireDefault(require("./colors"));
|
|
9
9
|
var _buttonColors = _interopRequireDefault(require("./buttonColors"));
|
|
10
|
+
var _buttonTypes = _interopRequireDefault(require("./buttonTypes"));
|
|
10
11
|
var _linkStyles = _interopRequireDefault(require("./linkStyles"));
|
|
11
12
|
var _fontSizes = _interopRequireDefault(require("./fontSizes"));
|
|
12
13
|
var _allBreakpoints = _interopRequireDefault(require("../shared/allBreakpoints"));
|
|
@@ -15,6 +16,7 @@ var _fontFamilies = _interopRequireDefault(require("../shared/fontFamilies"));
|
|
|
15
16
|
var _default = exports.default = {
|
|
16
17
|
color: _colors.default,
|
|
17
18
|
buttonColors: _buttonColors.default,
|
|
19
|
+
buttonTypes: _buttonTypes.default,
|
|
18
20
|
linkStyles: _linkStyles.default,
|
|
19
21
|
fontSize: _fontSizes.default,
|
|
20
22
|
allBreakpoints: _allBreakpoints.default,
|
package/package.json
CHANGED
|
@@ -101,7 +101,7 @@ test.describe('Email Signup Form component', () => {
|
|
|
101
101
|
await page.locator('[data-testid="EmailSignUpForm-example-1"] #email').type('email-signup@email.sls.comicrelief.com');
|
|
102
102
|
|
|
103
103
|
// submit the ESU form
|
|
104
|
-
await page.locator('[data-testid="EmailSignUpForm-example-1"] button[type="submit"]
|
|
104
|
+
await page.locator('[data-testid="EmailSignUpForm-example-1"] button[type="submit"]').click();
|
|
105
105
|
|
|
106
106
|
await page.close();
|
|
107
107
|
});
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const StyledButton = styled.button`
|
|
7
|
-
display: inline-flex;
|
|
8
|
-
position: relative;
|
|
9
|
-
padding: 0.5rem 1.25rem;
|
|
10
|
-
text-decoration: none;
|
|
11
|
-
font-weight: 700;
|
|
12
|
-
font-size: ${({ theme }) => theme.fontSize('s')};
|
|
13
|
-
border-radius: 2rem;
|
|
14
|
-
transition: all 0.3s;
|
|
15
|
-
height: 3.125rem;
|
|
16
|
-
width: 100%;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
align-items: center;
|
|
19
|
-
border: none;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
> a {
|
|
22
|
-
text-decoration: none;
|
|
23
|
-
}
|
|
24
|
-
${({ color, theme }) => (color ? theme.buttonColors(color) : theme.buttonColors('red'))};
|
|
25
|
-
|
|
26
|
-
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
27
|
-
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
31
|
-
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
32
|
-
padding: ${spacing('md')} ${spacing('l')};
|
|
33
|
-
margin: 0 auto ${spacing('l')};
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
3
|
+
import StyledButton from './Button.style';
|
|
4
|
+
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
36
5
|
|
|
37
6
|
const Button = React.forwardRef(({
|
|
38
|
-
children,
|
|
7
|
+
children,
|
|
8
|
+
color = 'red',
|
|
9
|
+
wrapper = false,
|
|
10
|
+
fullWidth = false,
|
|
11
|
+
buttonType = buttonTypes.PRIMARY,
|
|
12
|
+
...rest
|
|
39
13
|
}, ref) => (
|
|
40
|
-
<StyledButton {...rest} as={wrapper ? 'span' : 'button'} ref={ref} fullWidth={fullWidth}>
|
|
14
|
+
<StyledButton {...rest} as={wrapper ? 'span' : 'button'} ref={ref} fullWidth={fullWidth} color={color} buttonType={buttonType}>
|
|
41
15
|
{children}
|
|
42
16
|
</StyledButton>
|
|
43
17
|
));
|
|
@@ -45,7 +19,15 @@ const Button = React.forwardRef(({
|
|
|
45
19
|
Button.propTypes = {
|
|
46
20
|
children: PropTypes.node.isRequired,
|
|
47
21
|
wrapper: PropTypes.bool, // Buttons as span
|
|
48
|
-
fullWidth: PropTypes.bool
|
|
22
|
+
fullWidth: PropTypes.bool,
|
|
23
|
+
color: PropTypes.string,
|
|
24
|
+
// Primary will the default for the vast majority of contexts; with
|
|
25
|
+
// Secondary and Tertirary being manually set by developers where required
|
|
26
|
+
buttonType: PropTypes.oneOf([
|
|
27
|
+
buttonTypes.PRIMARY,
|
|
28
|
+
buttonTypes.SECONDARY,
|
|
29
|
+
buttonTypes.TERTIARY
|
|
30
|
+
])
|
|
49
31
|
};
|
|
50
32
|
|
|
51
33
|
export default Button;
|
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
```js
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
4
|
+
|
|
5
|
+
<>
|
|
6
|
+
<h1>Primary</h1>
|
|
7
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
8
|
+
<Button type="button">Primary red button (default)</Button>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
12
|
+
<Button type="button" disabled>Primary red button (default): disabled</Button>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
16
|
+
<Button type="button" color="black">Primary black button</Button>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
20
|
+
<Button type="button" color="black" disabled>Primary black button: disabled</Button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
24
|
+
<Button type="button" color="white">Primary white button</Button>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
28
|
+
<Button type="button" color="white" disabled>Primary white button: disabled</Button>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
32
|
+
<Button type="button" color="non-existent-colour">Using a non-existent colour will default to red</Button>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<br/>
|
|
36
|
+
<h1>Secondary</h1>
|
|
37
|
+
|
|
38
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px", borderRadius: "5px"}}>
|
|
39
|
+
<Button type="button" buttonType={buttonTypes.SECONDARY}>Secondary red button</Button>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
43
|
+
<Button type="button" buttonType={buttonTypes.SECONDARY} disabled>Secondary red button: disabled</Button>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
47
|
+
<Button type="button" color="black" buttonType={buttonTypes.SECONDARY}>Secondary black button</Button>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
51
|
+
<Button type="button" color="black" buttonType={buttonTypes.SECONDARY} disabled>Secondary black button: disabled</Button>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
56
|
+
<Button type="button" color="white" buttonType={buttonTypes.SECONDARY} buttonType={buttonTypes.SECONDARY}>Secondary white button</Button>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
60
|
+
<Button type="button" color="white" buttonType={buttonTypes.SECONDARY} disabled>Secondary white button: disabled</Button>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<br/>
|
|
64
|
+
<h1>Teritary</h1>
|
|
65
|
+
|
|
66
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
67
|
+
<Button type="button" buttonType={buttonTypes.TERTIARY}>Tertiary red button</Button>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
71
|
+
<Button type="button" buttonType={buttonTypes.TERTIARY} disabled>Tertiary red button: disabled</Button>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
75
|
+
<Button type="button" color="black" buttonType={buttonTypes.TERTIARY}>Tertiary black button</Button>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
79
|
+
<Button type="button" color="black" buttonType={buttonTypes.TERTIARY} disabled>Tertiary black button: disabled</Button>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
84
|
+
<Button type="button" color="white" buttonType={buttonTypes.TERTIARY} buttonType={buttonTypes.TERTIARY}>Tertiary white button</Button>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
88
|
+
<Button type="button" color="white" buttonType={buttonTypes.TERTIARY} disabled>Tertiary white button: disabled</Button>
|
|
89
|
+
</div>
|
|
90
|
+
</>
|
|
91
|
+
|
|
92
|
+
|
|
3
93
|
```
|
|
4
94
|
|
|
5
95
|
```js
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import fontHelper from '../../../theme/crTheme/fontHelper';
|
|
3
|
+
|
|
4
|
+
const StyledButton = styled.button`
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
position: relative;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
transition: all 0.2s;
|
|
9
|
+
min-height: 2.5rem;
|
|
10
|
+
width: 100%;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
border: none;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
padding: 0.6rem 1rem;
|
|
16
|
+
border-radius: 0.5rem;
|
|
17
|
+
|
|
18
|
+
> a {
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
${({ color, theme, buttonType }) => (theme.buttonColors(color, buttonType))};
|
|
23
|
+
|
|
24
|
+
${({ theme }) => css`${fontHelper(theme, 'button')}`}
|
|
25
|
+
|
|
26
|
+
@media ${({ theme }) => theme.allBreakpoints('M')} {
|
|
27
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media ${({ theme }) => theme.allBreakpoints('L')} {
|
|
31
|
+
// I don't *believe* this needs to be reinstated, but leaving in
|
|
32
|
+
// place for now, just to avoid breaking anything downstream...
|
|
33
|
+
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export default StyledButton;
|