@comicrelief/component-library 7.35.10 → 7.36.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.
@@ -15,6 +15,7 @@ const Link = _ref => {
15
15
  let {
16
16
  children,
17
17
  color,
18
+ mobileColour,
18
19
  href,
19
20
  target,
20
21
  type,
@@ -54,6 +55,7 @@ const Link = _ref => {
54
55
  }, []);
55
56
  return /*#__PURE__*/_react.default.createElement(_Link.default, Object.assign({}, rest, {
56
57
  color: color,
58
+ mobileColour: mobileColour,
57
59
  href: href,
58
60
  target: window,
59
61
  type: type,
@@ -66,6 +68,7 @@ const Link = _ref => {
66
68
  Link.defaultProps = {
67
69
  type: 'standard',
68
70
  color: 'red',
71
+ mobileColour: null,
69
72
  target: null,
70
73
  home: false,
71
74
  underline: true,
@@ -40,12 +40,13 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
40
40
  <div style={{ display: 'block', marginBottom: '10px' }}>
41
41
  <Link
42
42
  color="red"
43
+ mobileColour="blue"
43
44
  href="#anchor"
44
45
  target="blank"
45
46
  type="button"
46
47
  icon={<Internal colour="white" />}
47
48
  >
48
- Internal link
49
+ Internal link, 'blue' on tablet and mobile
49
50
  </Link>
50
51
  </div>
51
52
 
@@ -9,7 +9,7 @@ exports.default = exports.IconWrapper = exports.HelperText = void 0;
9
9
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
10
10
  var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
11
11
  var _hideVisually = _interopRequireDefault(require("../../../theme/shared/hideVisually"));
12
- const buttonStyle = () => (0, _styledComponents.css)(["display:inline-flex;position:relative;padding:0.5rem 1.25rem;text-decoration:none;font-weight:700;font-size:", ";border-radius:2rem;transition:all 0.3s;height:3.125rem;width:100%;justify-content:center;align-items:center;cursor:pointer;", ";@media ", "{width:auto;}"], _ref => {
12
+ const buttonStyle = () => (0, _styledComponents.css)(["display:inline-flex;position:relative;padding:0.5rem 1.25rem;text-decoration:none;font-weight:700;font-size:", ";border-radius:2rem;transition:all 0.3s;height:3.125rem;width:100%;justify-content:center;align-items:center;cursor:pointer;", ";", ";@media ", "{width:auto;}@media ", "{", ";}"], _ref => {
13
13
  let {
14
14
  theme
15
15
  } = _ref;
@@ -22,49 +22,66 @@ const buttonStyle = () => (0, _styledComponents.css)(["display:inline-flex;posit
22
22
  return color ? theme.buttonColors(color) : theme.buttonColors('red');
23
23
  }, _ref3 => {
24
24
  let {
25
+ mobileColour,
25
26
  theme
26
27
  } = _ref3;
28
+ return mobileColour ? theme.buttonColors(mobileColour) : null;
29
+ }, _ref4 => {
30
+ let {
31
+ theme
32
+ } = _ref4;
27
33
  return theme.breakpoint('small');
34
+ }, _ref5 => {
35
+ let {
36
+ theme
37
+ } = _ref5;
38
+ return theme.breakpoint('medium');
39
+ }, _ref6 => {
40
+ let {
41
+ color,
42
+ theme
43
+ } = _ref6;
44
+ return color ? theme.buttonColors(color) : theme.buttonColors('red');
28
45
  });
29
- const linkStyle = () => (0, _styledComponents.css)(["position:relative;text-decoration:none;display:inline;line-height:", ";", ";"], _ref4 => {
46
+ const linkStyle = () => (0, _styledComponents.css)(["position:relative;text-decoration:none;display:inline;line-height:", ";", ";"], _ref7 => {
30
47
  let {
31
48
  theme
32
- } = _ref4;
49
+ } = _ref7;
33
50
  return theme.fontSize('l');
34
- }, _ref5 => {
51
+ }, _ref8 => {
35
52
  let {
36
53
  type,
37
54
  theme,
38
55
  underline
39
- } = _ref5;
56
+ } = _ref8;
40
57
  return type ? theme.linkStyles(type, underline) : theme.linkStyles('standard', underline);
41
58
  });
42
59
  const IconWrapper = exports.IconWrapper = _styledComponents.default.span.withConfig({
43
60
  displayName: "Linkstyle__IconWrapper",
44
61
  componentId: "sc-t360tr-0"
45
- })(["display:inline-flex;margin-left:", ";align-self:center;right:", ";", ";@media ", "{width:auto;right:auto;position:relative;", ";}"], (0, _spacing.default)('md'), (0, _spacing.default)('m'), _ref6 => {
62
+ })(["display:inline-flex;margin-left:", ";align-self:center;right:", ";", ";@media ", "{width:auto;right:auto;position:relative;", ";}"], (0, _spacing.default)('md'), (0, _spacing.default)('m'), _ref9 => {
46
63
  let {
47
64
  type
48
- } = _ref6;
65
+ } = _ref9;
49
66
  return type === 'standard' && (0, _styledComponents.css)(["position:absolute;right:-2rem;top:0;bottom:0;"]);
50
- }, _ref7 => {
67
+ }, _ref10 => {
51
68
  let {
52
69
  theme
53
- } = _ref7;
70
+ } = _ref10;
54
71
  return theme.breakpoint('small');
55
- }, _ref8 => {
72
+ }, _ref11 => {
56
73
  let {
57
74
  type
58
- } = _ref8;
75
+ } = _ref11;
59
76
  return type === 'standard' && (0, _styledComponents.css)(["position:absolute;right:-2rem;top:0;bottom:0;"]);
60
77
  });
61
78
  const StyledLink = _styledComponents.default.a.withConfig({
62
79
  displayName: "Linkstyle__StyledLink",
63
80
  componentId: "sc-t360tr-1"
64
- })(["", " ", ";"], props => props.type === 'button' ? buttonStyle : linkStyle, _ref9 => {
81
+ })(["", " ", ";"], props => props.type === 'button' ? buttonStyle : linkStyle, _ref12 => {
65
82
  let {
66
83
  iconFirst
67
- } = _ref9;
84
+ } = _ref12;
68
85
  return iconFirst && (0, _styledComponents.css)(["flex-direction:row-reverse;span[type=\"button\"]{margin-left:0;margin-right:1rem;}"]);
69
86
  });
70
87
  const HelperText = exports.HelperText = _styledComponents.default.span.withConfig({
@@ -6,14 +6,14 @@ require("jest-styled-components");
6
6
  var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
7
7
  var _Link = _interopRequireDefault(require("./Link"));
8
8
  var _index = require("../Icons/index");
9
- it('renders a standard styled link correctly', () => {
9
+ it("renders a standard styled link correctly", () => {
10
10
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Link.default, {
11
11
  href: "/test",
12
12
  type: "standard"
13
13
  }, "A standard link")).toJSON();
14
14
  expect(tree).toMatchInlineSnapshot("\n .c0 {\n position: relative;\n -webkit-text-decoration: none;\n text-decoration: none;\n display: inline;\n line-height: 1.5rem;\n color: #000000;\n border-bottom: 2px solid #000000;\n font-weight: normal;\n }\n\n .c0:hover {\n color: #000000;\n border-bottom: 2px solid #000000;\n }\n\n <a\n className=\"c0\"\n color=\"red\"\n href=\"/test\"\n target=\"_self\"\n type=\"standard\"\n >\n A standard link\n </a>\n ");
15
15
  });
16
- it('renders a button with an icon', () => {
16
+ it("renders a button with an icon", () => {
17
17
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Link.default, {
18
18
  href: "/test",
19
19
  type: "standard",
@@ -24,7 +24,7 @@ it('renders a button with an icon', () => {
24
24
  }, "Internal link")).toJSON();
25
25
  expect(tree).toMatchInlineSnapshot("\n .c1 {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n margin-left: 1rem;\n -webkit-align-self: center;\n -ms-flex-item-align: center;\n align-self: center;\n right: 1.5rem;\n position: absolute;\n right: -2rem;\n top: 0;\n bottom: 0;\n }\n\n .c0 {\n position: relative;\n -webkit-text-decoration: none;\n text-decoration: none;\n display: inline;\n line-height: 1.5rem;\n color: #000000;\n border-bottom: 2px solid #000000;\n font-weight: normal;\n }\n\n .c0:hover {\n color: #000000;\n border-bottom: 2px solid #000000;\n }\n\n @media (min-width:740px) {\n .c1 {\n width: auto;\n right: auto;\n position: relative;\n position: absolute;\n right: -2rem;\n top: 0;\n bottom: 0;\n }\n }\n\n <a\n className=\"c0\"\n color=\"red\"\n href=\"/test\"\n target=\"_self\"\n type=\"standard\"\n >\n Internal link\n <span\n className=\"c1\"\n type=\"standard\"\n >\n <svg\n fill=\"#FFFFFF\"\n height={24}\n viewBox=\"0 0 96 96\"\n width={24}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M90.871 50.776c-.016.016-.026.036-.043.052l-32 32C58.047 83.609 57.024 84 56 84s-2.047-.391-2.829-1.171a4 4 0 010-5.657L78.343 52H8a4 4 0 010-8h70.343L53.171 18.829a4 4 0 015.657-5.657l32 32c.016.016.027.036.043.052.167.172.321.357.455.557.069.104.118.216.176.325.065.121.138.236.191.364.057.137.09.279.13.42.032.109.074.214.097.327a4.017 4.017 0 010 1.568c-.023.113-.065.217-.097.327-.041.141-.074.283-.13.42-.053.128-.126.243-.191.364-.059.109-.107.221-.176.325a4.035 4.035 0 01-.455.555z\"\n />\n </svg>\n </span>\n </a>\n ");
26
26
  });
27
- it('renders a standard styled link correctly with target blank and assistive text', () => {
27
+ it("renders a standard styled link correctly with target blank and assistive text", () => {
28
28
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Link.default, {
29
29
  href: "/test",
30
30
  type: "standard",
@@ -32,11 +32,11 @@ it('renders a standard styled link correctly with target blank and assistive tex
32
32
  }, "A standard link")).toJSON();
33
33
  expect(tree).toMatchInlineSnapshot("\n .c0 {\n position: relative;\n -webkit-text-decoration: none;\n text-decoration: none;\n display: inline;\n line-height: 1.5rem;\n color: #000000;\n border-bottom: 2px solid #000000;\n font-weight: normal;\n }\n\n .c0:hover {\n color: #000000;\n border-bottom: 2px solid #000000;\n }\n\n .c1 {\n border: 0;\n -webkit-clip: rect(0 0 0 0);\n clip: rect(0 0 0 0);\n -webkit-clip-path: inset(50%);\n clip-path: inset(50%);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n\n <a\n className=\"c0\"\n color=\"red\"\n href=\"/test\"\n target=\"_blank\"\n type=\"standard\"\n >\n A standard link\n <span\n className=\"c1\"\n >\n (opens in new window)\n </span>\n </a>\n ");
34
34
  });
35
- it('renders link styled as button correctly', () => {
35
+ it("renders link styled as button correctly", () => {
36
36
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Link.default, {
37
37
  href: "/test",
38
38
  type: "button",
39
39
  color: "yellow"
40
40
  }, "A yellow button")).toJSON();
41
- expect(tree).toMatchInlineSnapshot("\n .c0 {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n padding: 0.5rem 1.25rem;\n -webkit-text-decoration: none;\n text-decoration: none;\n font-weight: 700;\n font-size: 1rem;\n border-radius: 2rem;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n height: 3.125rem;\n width: 100%;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n cursor: pointer;\n background-color: #FFE400;\n color: #000000;\n }\n\n .c0:hover {\n background-color: #FEFD5A;\n color: #000000;\n }\n\n @media (min-width:740px) {\n .c0 {\n width: auto;\n }\n }\n\n <a\n className=\"c0\"\n color=\"yellow\"\n href=\"/test\"\n target=\"_self\"\n type=\"button\"\n >\n A yellow button\n </a>\n ");
41
+ expect(tree).toMatchInlineSnapshot("\n .c0 {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n padding: 0.5rem 1.25rem;\n -webkit-text-decoration: none;\n text-decoration: none;\n font-weight: 700;\n font-size: 1rem;\n border-radius: 2rem;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n height: 3.125rem;\n width: 100%;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n cursor: pointer;\n background-color: #FFE400;\n color: #000000;\n }\n\n .c0:hover {\n background-color: #FEFD5A;\n color: #000000;\n }\n\n @media (min-width:740px) {\n .c0 {\n width: auto;\n }\n }\n\n @media (min-width:1024px) {\n .c0 {\n background-color: #FFE400;\n color: #000000;\n }\n\n .c0:hover {\n background-color: #FEFD5A;\n color: #000000;\n }\n }\n\n <a\n className=\"c0\"\n color=\"yellow\"\n href=\"/test\"\n target=\"_self\"\n type=\"button\"\n >\n A yellow button\n </a>\n ");
42
42
  });
@@ -129,6 +129,18 @@ exports[`renders correctly 1`] = `
129
129
  }
130
130
  }
131
131
 
132
+ @media (min-width:1024px) {
133
+ .c7 {
134
+ background-color: #E52630;
135
+ color: #FFFFFF;
136
+ }
137
+
138
+ .c7:hover {
139
+ background-color: #890B11;
140
+ color: #FFFFFF;
141
+ }
142
+ }
143
+
132
144
  @media (min-width:740px) {
133
145
  .c0 {
134
146
  -webkit-flex-direction: row;
@@ -159,6 +159,18 @@ exports[`renders Promo correctly 1`] = `
159
159
  }
160
160
  }
161
161
 
162
+ @media (min-width:1024px) {
163
+ .c9 {
164
+ background-color: #FFFFFF;
165
+ color: #000000;
166
+ }
167
+
168
+ .c9:hover {
169
+ background-color: #969598;
170
+ color: #000000;
171
+ }
172
+ }
173
+
162
174
  @media (min-width:1024px) {
163
175
  .c0 {
164
176
  -webkit-flex-direction: row;
@@ -425,6 +437,18 @@ exports[`renders Promo correctly end position 1`] = `
425
437
  }
426
438
  }
427
439
 
440
+ @media (min-width:1024px) {
441
+ .c9 {
442
+ background-color: #FFFFFF;
443
+ color: #000000;
444
+ }
445
+
446
+ .c9:hover {
447
+ background-color: #969598;
448
+ color: #000000;
449
+ }
450
+ }
451
+
428
452
  @media (min-width:1024px) {
429
453
  .c0 {
430
454
  -webkit-flex-direction: row;
@@ -284,6 +284,18 @@ exports[`renders Single Message with Image correctly 1`] = `
284
284
  }
285
285
  }
286
286
 
287
+ @media (min-width:1024px) {
288
+ .c8 {
289
+ background-color: #FFFFFF;
290
+ color: #000000;
291
+ }
292
+
293
+ .c8:hover {
294
+ background-color: #969598;
295
+ color: #000000;
296
+ }
297
+ }
298
+
287
299
  @media (min-width:740px) {
288
300
  .c0 {
289
301
  -webkit-flex-direction: row;
@@ -730,6 +742,18 @@ exports[`renders Single Message with full width correctly 1`] = `
730
742
  }
731
743
  }
732
744
 
745
+ @media (min-width:1024px) {
746
+ .c8 {
747
+ background-color: #FFFFFF;
748
+ color: #000000;
749
+ }
750
+
751
+ .c8:hover {
752
+ background-color: #969598;
753
+ color: #000000;
754
+ }
755
+ }
756
+
733
757
  @media (min-width:740px) {
734
758
  .c0 {
735
759
  -webkit-flex-direction: row;
@@ -920,6 +944,10 @@ exports[`renders Single Message with full width image and no text correctly 1`]
920
944
 
921
945
  }
922
946
 
947
+ @media (min-width:1024px) {
948
+
949
+ }
950
+
923
951
  @media (min-width:740px) {
924
952
  .c0 {
925
953
  -webkit-flex-direction: row;
@@ -1042,6 +1070,10 @@ exports[`renders Single Message with no Image correctly 1`] = `
1042
1070
 
1043
1071
  }
1044
1072
 
1073
+ @media (min-width:1024px) {
1074
+
1075
+ }
1076
+
1045
1077
  @media (min-width:740px) {
1046
1078
  .c0 {
1047
1079
  -webkit-flex-direction: row;
@@ -163,6 +163,18 @@ exports[`renders correctly 1`] = `
163
163
  }
164
164
  }
165
165
 
166
+ @media (min-width:1024px) {
167
+ .c11 {
168
+ background-color: #2042AD;
169
+ color: #FFFFFF;
170
+ }
171
+
172
+ .c11:hover {
173
+ background-color: #274084;
174
+ color: #FFFFFF;
175
+ }
176
+ }
177
+
166
178
  @media (min-width:740px) {
167
179
  .c0 {
168
180
  -webkit-flex-direction: row;
@@ -5,17 +5,17 @@ var _react = _interopRequireDefault(require("react"));
5
5
  require("jest-styled-components");
6
6
  var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
7
7
  var _CookieBanner = _interopRequireDefault(require("./CookieBanner"));
8
- it('renders correctly', () => {
8
+ it("renders correctly", () => {
9
9
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_CookieBanner.default, {
10
10
  acceptCookie: e => {
11
11
  e.preventDefault();
12
- return 'User accept';
12
+ return "User accept";
13
13
  },
14
14
  denyCookie: e => {
15
15
  e.preventDefault();
16
- return 'User does not accept cookies';
16
+ return "User does not accept cookies";
17
17
  },
18
18
  cookiePolicyUrl: "https://www.comicrelief.com/cookies-policy"
19
19
  })).toJSON();
20
- expect(tree).toMatchInlineSnapshot("\n .c1 {\n color: #FFFFFF;\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c3 {\n position: relative;\n -webkit-text-decoration: none;\n text-decoration: none;\n display: inline;\n line-height: 1.5rem;\n color: #FFFFFF;\n border-bottom: 2px solid #FFFFFF;\n font-weight: normal;\n }\n\n .c3:hover {\n color: #FFFFFF;\n border-bottom: 2px solid #FFFFFF;\n }\n\n .c5 {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n padding: 0.5rem 1.25rem;\n -webkit-text-decoration: none;\n text-decoration: none;\n font-weight: 700;\n font-size: 1rem;\n border-radius: 2rem;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n height: 3.125rem;\n width: 100%;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n cursor: pointer;\n background-color: #FFFFFF;\n color: #000000;\n }\n\n .c5:hover {\n background-color: #969598;\n color: #000000;\n }\n\n .c0 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n padding: 1rem;\n background: #2C0230;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n z-index: 3;\n }\n\n .c2 {\n line-height: 1.5;\n margin: 0;\n }\n\n .c2:first-of-type {\n margin-bottom: 0.5rem;\n }\n\n .c6 {\n padding: 0.5rem 1rem;\n display: block;\n margin-bottom: 10px;\n }\n\n .c4 {\n color: #FFFFFF;\n padding: 0 0.25rem 1px;\n border-bottom: 2px solid;\n }\n\n @media (min-width:740px) {\n .c5 {\n width: auto;\n }\n }\n\n @media (min-width:740px) {\n .c2 {\n width: 75%;\n margin: 0 auto;\n }\n\n .c2:first-of-type {\n margin-bottom: 1rem;\n }\n }\n\n @media (min-width:740px) {\n .c6 {\n margin: 0 0.25rem 0 0;\n display: inline-block;\n }\n }\n\n <div\n className=\"c0\"\n >\n <p\n className=\"c1 c2\"\n color=\"white\"\n size=\"s\"\n >\n Hello! Comic Relief uses cookies to help make this website better and improve our services. You can learn more about\n <a\n className=\"c3 c4\"\n color=\"red\"\n href=\"https://www.comicrelief.com/cookies-policy\"\n target=\"_self\"\n type=\"standard_white\"\n >\n our use of cookies\n </a>\n . We also use optional cookies for marketing purposes:\n </p>\n <p\n className=\"c1 c2\"\n color=\"white\"\n size=\"s\"\n >\n <a\n className=\"c5 c6\"\n color=\"white\"\n href=\"/comic\"\n onClick={[Function]}\n target=\"_self\"\n type=\"button\"\n >\n Accept\n </a>\n Or click\n <a\n className=\"c3 c4\"\n color=\"red\"\n href=\"\"\n onClick={[Function]}\n target=\"_self\"\n type=\"standard_white\"\n >\n here\n </a>\n to deny these.\n </p>\n </div>\n ");
20
+ expect(tree).toMatchInlineSnapshot("\n .c1 {\n color: #FFFFFF;\n font-size: 1rem;\n line-height: 1rem;\n text-transform: inherit;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c3 {\n position: relative;\n -webkit-text-decoration: none;\n text-decoration: none;\n display: inline;\n line-height: 1.5rem;\n color: #FFFFFF;\n border-bottom: 2px solid #FFFFFF;\n font-weight: normal;\n }\n\n .c3:hover {\n color: #FFFFFF;\n border-bottom: 2px solid #FFFFFF;\n }\n\n .c5 {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n padding: 0.5rem 1.25rem;\n -webkit-text-decoration: none;\n text-decoration: none;\n font-weight: 700;\n font-size: 1rem;\n border-radius: 2rem;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n height: 3.125rem;\n width: 100%;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n cursor: pointer;\n background-color: #FFFFFF;\n color: #000000;\n }\n\n .c5:hover {\n background-color: #969598;\n color: #000000;\n }\n\n .c0 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n padding: 1rem;\n background: #2C0230;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n z-index: 3;\n }\n\n .c2 {\n line-height: 1.5;\n margin: 0;\n }\n\n .c2:first-of-type {\n margin-bottom: 0.5rem;\n }\n\n .c6 {\n padding: 0.5rem 1rem;\n display: block;\n margin-bottom: 10px;\n }\n\n .c4 {\n color: #FFFFFF;\n padding: 0 0.25rem 1px;\n border-bottom: 2px solid;\n }\n\n @media (min-width:740px) {\n .c5 {\n width: auto;\n }\n }\n\n @media (min-width:1024px) {\n .c5 {\n background-color: #FFFFFF;\n color: #000000;\n }\n\n .c5:hover {\n background-color: #969598;\n color: #000000;\n }\n }\n\n @media (min-width:740px) {\n .c2 {\n width: 75%;\n margin: 0 auto;\n }\n\n .c2:first-of-type {\n margin-bottom: 1rem;\n }\n }\n\n @media (min-width:740px) {\n .c6 {\n margin: 0 0.25rem 0 0;\n display: inline-block;\n }\n }\n\n <div\n className=\"c0\"\n >\n <p\n className=\"c1 c2\"\n color=\"white\"\n size=\"s\"\n >\n Hello! Comic Relief uses cookies to help make this website better and improve our services. You can learn more about\n <a\n className=\"c3 c4\"\n color=\"red\"\n href=\"https://www.comicrelief.com/cookies-policy\"\n target=\"_self\"\n type=\"standard_white\"\n >\n our use of cookies\n </a>\n . We also use optional cookies for marketing purposes:\n </p>\n <p\n className=\"c1 c2\"\n color=\"white\"\n size=\"s\"\n >\n <a\n className=\"c5 c6\"\n color=\"white\"\n href=\"/comic\"\n onClick={[Function]}\n target=\"_self\"\n type=\"button\"\n >\n Accept\n </a>\n Or click\n <a\n className=\"c3 c4\"\n color=\"red\"\n href=\"\"\n onClick={[Function]}\n target=\"_self\"\n type=\"standard_white\"\n >\n here\n </a>\n to deny these.\n </p>\n </div>\n ");
21
21
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "7.35.10",
4
+ "version": "7.36.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -10,6 +10,7 @@ let window = '';
10
10
  const Link = ({
11
11
  children,
12
12
  color,
13
+ mobileColour,
13
14
  href,
14
15
  target,
15
16
  type,
@@ -54,6 +55,7 @@ const Link = ({
54
55
  <StyledLink
55
56
  {...rest}
56
57
  color={color}
58
+ mobileColour={mobileColour}
57
59
  href={href}
58
60
  target={window}
59
61
  type={type}
@@ -72,6 +74,7 @@ Link.propTypes = {
72
74
  type: PropTypes.oneOf(['button', 'standard', 'standard_white']),
73
75
  /** Color for button style link. See buttonColors in theme */
74
76
  color: PropTypes.string,
77
+ mobileColour: PropTypes.string,
75
78
  /** Link target */
76
79
  target: PropTypes.string,
77
80
  /** Set to true if link rel attribute should be home */
@@ -89,6 +92,7 @@ Link.propTypes = {
89
92
  Link.defaultProps = {
90
93
  type: 'standard',
91
94
  color: 'red',
95
+ mobileColour: null,
92
96
  target: null,
93
97
  home: false,
94
98
  underline: true,
@@ -40,12 +40,13 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
40
40
  <div style={{ display: 'block', marginBottom: '10px' }}>
41
41
  <Link
42
42
  color="red"
43
+ mobileColour="blue"
43
44
  href="#anchor"
44
45
  target="blank"
45
46
  type="button"
46
47
  icon={<Internal colour="white" />}
47
48
  >
48
- Internal link
49
+ Internal link, 'blue' on tablet and mobile
49
50
  </Link>
50
51
  </div>
51
52
 
@@ -17,9 +17,18 @@ const buttonStyle = () => css`
17
17
  align-items: center;
18
18
  cursor: pointer;
19
19
  ${({ color, theme }) => (color ? theme.buttonColors(color) : theme.buttonColors('red'))};
20
+
21
+ // Override with mobile-specific colours where available:
22
+ ${({ mobileColour, theme }) => (mobileColour ? theme.buttonColors(mobileColour) : null)};
23
+
20
24
  @media ${({ theme }) => theme.breakpoint('small')} {
21
25
  width: auto;
22
26
  }
27
+
28
+ // Reinstate general styles for 'desktop':
29
+ @media ${({ theme }) => theme.breakpoint('medium')} {
30
+ ${({ color, theme }) => (color ? theme.buttonColors(color) : theme.buttonColors('red'))};
31
+ }
23
32
  `;
24
33
 
25
34
  const linkStyle = () => css`
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import 'jest-styled-components';
3
- import renderWithTheme from '../../../hoc/shallowWithTheme';
4
- import Link from './Link';
5
- import { Internal } from '../Icons/index';
1
+ import React from "react";
2
+ import "jest-styled-components";
3
+ import renderWithTheme from "../../../hoc/shallowWithTheme";
4
+ import Link from "./Link";
5
+ import { Internal } from "../Icons/index";
6
6
 
7
- it('renders a standard styled link correctly', () => {
7
+ it("renders a standard styled link correctly", () => {
8
8
  const tree = renderWithTheme(
9
9
  <Link href="/test" type="standard">
10
10
  A standard link
@@ -40,7 +40,7 @@ it('renders a standard styled link correctly', () => {
40
40
  `);
41
41
  });
42
42
 
43
- it('renders a button with an icon', () => {
43
+ it("renders a button with an icon", () => {
44
44
  const tree = renderWithTheme(
45
45
  <Link
46
46
  href="/test"
@@ -125,7 +125,7 @@ it('renders a button with an icon', () => {
125
125
  `);
126
126
  });
127
127
 
128
- it('renders a standard styled link correctly with target blank and assistive text', () => {
128
+ it("renders a standard styled link correctly with target blank and assistive text", () => {
129
129
  const tree = renderWithTheme(
130
130
  <Link href="/test" type="standard" target="blank">
131
131
  A standard link
@@ -181,7 +181,7 @@ it('renders a standard styled link correctly with target blank and assistive tex
181
181
  `);
182
182
  });
183
183
 
184
- it('renders link styled as button correctly', () => {
184
+ it("renders link styled as button correctly", () => {
185
185
  const tree = renderWithTheme(
186
186
  <Link href="/test" type="button" color="yellow">
187
187
  A yellow button
@@ -229,6 +229,18 @@ it('renders link styled as button correctly', () => {
229
229
  }
230
230
  }
231
231
 
232
+ @media (min-width:1024px) {
233
+ .c0 {
234
+ background-color: #FFE400;
235
+ color: #000000;
236
+ }
237
+
238
+ .c0:hover {
239
+ background-color: #FEFD5A;
240
+ color: #000000;
241
+ }
242
+ }
243
+
232
244
  <a
233
245
  className="c0"
234
246
  color="yellow"
@@ -129,6 +129,18 @@ exports[`renders correctly 1`] = `
129
129
  }
130
130
  }
131
131
 
132
+ @media (min-width:1024px) {
133
+ .c7 {
134
+ background-color: #E52630;
135
+ color: #FFFFFF;
136
+ }
137
+
138
+ .c7:hover {
139
+ background-color: #890B11;
140
+ color: #FFFFFF;
141
+ }
142
+ }
143
+
132
144
  @media (min-width:740px) {
133
145
  .c0 {
134
146
  -webkit-flex-direction: row;
@@ -159,6 +159,18 @@ exports[`renders Promo correctly 1`] = `
159
159
  }
160
160
  }
161
161
 
162
+ @media (min-width:1024px) {
163
+ .c9 {
164
+ background-color: #FFFFFF;
165
+ color: #000000;
166
+ }
167
+
168
+ .c9:hover {
169
+ background-color: #969598;
170
+ color: #000000;
171
+ }
172
+ }
173
+
162
174
  @media (min-width:1024px) {
163
175
  .c0 {
164
176
  -webkit-flex-direction: row;
@@ -425,6 +437,18 @@ exports[`renders Promo correctly end position 1`] = `
425
437
  }
426
438
  }
427
439
 
440
+ @media (min-width:1024px) {
441
+ .c9 {
442
+ background-color: #FFFFFF;
443
+ color: #000000;
444
+ }
445
+
446
+ .c9:hover {
447
+ background-color: #969598;
448
+ color: #000000;
449
+ }
450
+ }
451
+
428
452
  @media (min-width:1024px) {
429
453
  .c0 {
430
454
  -webkit-flex-direction: row;
@@ -284,6 +284,18 @@ exports[`renders Single Message with Image correctly 1`] = `
284
284
  }
285
285
  }
286
286
 
287
+ @media (min-width:1024px) {
288
+ .c8 {
289
+ background-color: #FFFFFF;
290
+ color: #000000;
291
+ }
292
+
293
+ .c8:hover {
294
+ background-color: #969598;
295
+ color: #000000;
296
+ }
297
+ }
298
+
287
299
  @media (min-width:740px) {
288
300
  .c0 {
289
301
  -webkit-flex-direction: row;
@@ -730,6 +742,18 @@ exports[`renders Single Message with full width correctly 1`] = `
730
742
  }
731
743
  }
732
744
 
745
+ @media (min-width:1024px) {
746
+ .c8 {
747
+ background-color: #FFFFFF;
748
+ color: #000000;
749
+ }
750
+
751
+ .c8:hover {
752
+ background-color: #969598;
753
+ color: #000000;
754
+ }
755
+ }
756
+
733
757
  @media (min-width:740px) {
734
758
  .c0 {
735
759
  -webkit-flex-direction: row;
@@ -920,6 +944,10 @@ exports[`renders Single Message with full width image and no text correctly 1`]
920
944
 
921
945
  }
922
946
 
947
+ @media (min-width:1024px) {
948
+
949
+ }
950
+
923
951
  @media (min-width:740px) {
924
952
  .c0 {
925
953
  -webkit-flex-direction: row;
@@ -1042,6 +1070,10 @@ exports[`renders Single Message with no Image correctly 1`] = `
1042
1070
 
1043
1071
  }
1044
1072
 
1073
+ @media (min-width:1024px) {
1074
+
1075
+ }
1076
+
1045
1077
  @media (min-width:740px) {
1046
1078
  .c0 {
1047
1079
  -webkit-flex-direction: row;
@@ -163,6 +163,18 @@ exports[`renders correctly 1`] = `
163
163
  }
164
164
  }
165
165
 
166
+ @media (min-width:1024px) {
167
+ .c11 {
168
+ background-color: #2042AD;
169
+ color: #FFFFFF;
170
+ }
171
+
172
+ .c11:hover {
173
+ background-color: #274084;
174
+ color: #FFFFFF;
175
+ }
176
+ }
177
+
166
178
  @media (min-width:740px) {
167
179
  .c0 {
168
180
  -webkit-flex-direction: row;
@@ -1,18 +1,18 @@
1
- import React from 'react';
2
- import 'jest-styled-components';
3
- import renderWithTheme from '../../../hoc/shallowWithTheme';
4
- import CookieBanner from './CookieBanner';
1
+ import React from "react";
2
+ import "jest-styled-components";
3
+ import renderWithTheme from "../../../hoc/shallowWithTheme";
4
+ import CookieBanner from "./CookieBanner";
5
5
 
6
- it('renders correctly', () => {
6
+ it("renders correctly", () => {
7
7
  const tree = renderWithTheme(
8
8
  <CookieBanner
9
- acceptCookie={e => {
9
+ acceptCookie={(e) => {
10
10
  e.preventDefault();
11
- return 'User accept';
11
+ return "User accept";
12
12
  }}
13
- denyCookie={e => {
13
+ denyCookie={(e) => {
14
14
  e.preventDefault();
15
- return 'User does not accept cookies';
15
+ return "User does not accept cookies";
16
16
  }}
17
17
  cookiePolicyUrl="https://www.comicrelief.com/cookies-policy"
18
18
  />
@@ -119,6 +119,18 @@ it('renders correctly', () => {
119
119
  }
120
120
  }
121
121
 
122
+ @media (min-width:1024px) {
123
+ .c5 {
124
+ background-color: #FFFFFF;
125
+ color: #000000;
126
+ }
127
+
128
+ .c5:hover {
129
+ background-color: #969598;
130
+ color: #000000;
131
+ }
132
+ }
133
+
122
134
  @media (min-width:740px) {
123
135
  .c2 {
124
136
  width: 75%;