@comicrelief/component-library 7.36.0 → 7.37.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.
Files changed (27) hide show
  1. package/dist/components/Atoms/Icons/Arrow.js +25 -4
  2. package/dist/components/Atoms/Icons/AtSign.js +32 -6
  3. package/dist/components/Atoms/Icons/Chevron.js +25 -3
  4. package/dist/components/Atoms/Icons/Download.js +31 -4
  5. package/dist/components/Atoms/Icons/External.js +31 -4
  6. package/dist/components/Atoms/Icons/Favourite.js +31 -4
  7. package/dist/components/Atoms/Icons/Internal.js +31 -4
  8. package/dist/components/Atoms/Link/Link.md +22 -21
  9. package/dist/components/Atoms/Link/Link.test.js +1 -1
  10. package/dist/components/Molecules/Accordion/__snapshots__/Accordion.test.js.snap +7 -0
  11. package/dist/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +11 -0
  12. package/dist/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +11 -0
  13. package/dist/theme/crTheme/buttonColors.js +1 -1
  14. package/package.json +1 -1
  15. package/src/components/Atoms/Icons/Arrow.js +13 -2
  16. package/src/components/Atoms/Icons/AtSign.js +20 -7
  17. package/src/components/Atoms/Icons/Chevron.js +13 -1
  18. package/src/components/Atoms/Icons/Download.js +18 -4
  19. package/src/components/Atoms/Icons/External.js +18 -4
  20. package/src/components/Atoms/Icons/Favourite.js +18 -4
  21. package/src/components/Atoms/Icons/Internal.js +18 -4
  22. package/src/components/Atoms/Link/Link.md +22 -21
  23. package/src/components/Atoms/Link/Link.test.js +11 -0
  24. package/src/components/Molecules/Accordion/__snapshots__/Accordion.test.js.snap +7 -0
  25. package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +11 -0
  26. package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +11 -0
  27. package/src/theme/crTheme/buttonColors.js +1 -1
@@ -17,25 +17,45 @@ const angle = {
17
17
  const Icon = _styledComponents.default.svg.withConfig({
18
18
  displayName: "Arrow__Icon",
19
19
  componentId: "sc-1iegggu-0"
20
- })(["transform:", ";"], _ref => {
20
+ })(["transform:", ";fill:", ";@media ", "{fill:", ";}"], _ref => {
21
21
  let {
22
22
  direction
23
23
  } = _ref;
24
24
  return "rotate(".concat(angle[direction], ")");
25
+ }, _ref2 => {
26
+ let {
27
+ mobileColour,
28
+ colour,
29
+ theme
30
+ } = _ref2;
31
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
32
+ }, _ref3 => {
33
+ let {
34
+ theme
35
+ } = _ref3;
36
+ return theme.breakpoint('medium');
37
+ }, _ref4 => {
38
+ let {
39
+ colour,
40
+ theme
41
+ } = _ref4;
42
+ return colour ? theme.color(colour) : theme.color('white');
25
43
  });
26
- const Arrow = _ref2 => {
44
+ const Arrow = _ref5 => {
27
45
  let {
28
46
  colour,
47
+ mobileColour,
29
48
  theme,
30
49
  size,
31
50
  direction,
32
51
  ...rest
33
- } = _ref2;
52
+ } = _ref5;
34
53
  return /*#__PURE__*/_react.default.createElement(Icon, Object.assign({
35
54
  direction: direction,
36
55
  width: size,
37
56
  height: size,
38
- fill: theme.color(colour),
57
+ colour: colour,
58
+ mobileColour: mobileColour,
39
59
  xmlns: "http://www.w3.org/2000/svg",
40
60
  viewBox: "0 0 96 96"
41
61
  }, rest), /*#__PURE__*/_react.default.createElement("path", {
@@ -46,6 +66,7 @@ const Arrow = _ref2 => {
46
66
  };
47
67
  Arrow.defaultProps = {
48
68
  colour: 'white',
69
+ mobileColour: null,
49
70
  size: 24,
50
71
  direction: 'up'
51
72
  };
@@ -1,24 +1,49 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = require("styled-components");
10
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
10
11
  const PATH_DATA = 'M40.811,9.307C36.607,4.664,30.48,2,24,2C11.458,2,2,11.458,2,24s9.458,22,22,22c10.221,0,14.032-3.779,15.29-5.031 c0.197-0.115,0.379-0.265,0.533-0.451c0.707-0.849,0.592-2.11-0.257-2.817c-0.438-0.362-1.61-1.049-3.093,0.427 C35.512,39.086,32.585,42,24,42C13.738,42,6,34.262,6,24S13.738,6,24,6c5.353,0,10.398,2.184,13.845,5.991 c3.162,3.495,4.642,8.044,4.165,12.81c-0.364,3.641-1.958,6.013-4.487,6.677c-1.853,0.487-3.658-0.145-4.269-1.011 c-1.001-1.422-0.753-4.747,0.009-8.237c1.035-3.375,2.104-6.939,2.177-7.179c0.308-1.027-0.249-2.114-1.263-2.465 c-1.012-0.349-2.122,0.161-2.515,1.159c-0.097,0.247-0.191,0.491-0.282,0.732c-1.427-1.455-3.424-2.421-5.724-2.66 c-3.983-0.41-9.547,1.602-12.107,8.643c-1.334,3.667-1.19,7.467,0.384,10.163c1.241,2.126,3.291,3.482,5.929,3.921 c4.299,0.714,7.438-0.837,9.464-3.098c0.254,0.695,0.516,1.122,0.659,1.325c1.66,2.358,5.257,3.443,8.555,2.576 c1.987-0.522,6.691-2.557,7.451-10.147C46.581,19.295,44.741,13.651,40.811,9.307z M37.871,41.195 c-0.149-0.03-0.3-0.081-0.448-0.152C37.567,41.112,37.718,41.163,37.871,41.195z M29.195,21.849 c-0.554,1.799-1.07,3.451-1.379,4.375c-0.413,1.243-2.174,5.229-7.297,4.374c-1.468-0.245-2.493-0.896-3.133-1.993 c-0.967-1.657-0.997-4.254-0.078-6.779c1.633-4.492,4.727-6.064,7.296-6.064c0.217,0,0.431,0.011,0.639,0.033 c1.952,0.203,4.068,1.433,4.396,3.726c0.01,0.074,0.024,0.146,0.043,0.217C29.49,20.479,29.329,21.181,29.195,21.849z';
11
- const AtSign = _ref => {
12
+ const StyledSVG = _styledComponents.default.svg.withConfig({
13
+ displayName: "AtSign__StyledSVG",
14
+ componentId: "sc-1328gc9-0"
15
+ })(["fill:", ";@media ", "{fill:", ";}"], _ref => {
16
+ let {
17
+ mobileColour,
18
+ colour,
19
+ theme
20
+ } = _ref;
21
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
22
+ }, _ref2 => {
23
+ let {
24
+ theme
25
+ } = _ref2;
26
+ return theme.breakpoint('medium');
27
+ }, _ref3 => {
28
+ let {
29
+ colour,
30
+ theme
31
+ } = _ref3;
32
+ return colour ? theme.color(colour) : theme.color('white');
33
+ });
34
+ const AtSign = _ref4 => {
12
35
  let {
13
36
  theme,
14
37
  size,
15
38
  colour,
39
+ mobileColour,
16
40
  ...rest
17
- } = _ref;
18
- return /*#__PURE__*/_react.default.createElement("svg", Object.assign({
41
+ } = _ref4;
42
+ return /*#__PURE__*/_react.default.createElement(StyledSVG, Object.assign({
19
43
  width: size,
20
44
  height: size,
21
- fill: theme.color(colour),
45
+ colour: colour,
46
+ mobileColour: mobileColour,
22
47
  viewBox: "0 0 48 48"
23
48
  }, rest), /*#__PURE__*/_react.default.createElement("path", {
24
49
  d: PATH_DATA
@@ -26,6 +51,7 @@ const AtSign = _ref => {
26
51
  };
27
52
  AtSign.defaultProps = {
28
53
  size: 24,
29
- colour: 'white'
54
+ colour: 'white',
55
+ mobileColour: null
30
56
  };
31
57
  var _default = exports.default = (0, _styledComponents.withTheme)(AtSign);
@@ -17,25 +17,46 @@ const angle = {
17
17
  const Icon = _styledComponents.default.svg.withConfig({
18
18
  displayName: "Chevron__Icon",
19
19
  componentId: "sc-1p4fsgl-0"
20
- })(["transform:", ";"], _ref => {
20
+ })(["transform:", ";fill:", ";@media ", "{fill:", ";}"], _ref => {
21
21
  let {
22
22
  direction
23
23
  } = _ref;
24
24
  return "rotate(".concat(angle[direction], ")");
25
+ }, _ref2 => {
26
+ let {
27
+ mobileColour,
28
+ colour,
29
+ theme
30
+ } = _ref2;
31
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
32
+ }, _ref3 => {
33
+ let {
34
+ theme
35
+ } = _ref3;
36
+ return theme.breakpoint('medium');
37
+ }, _ref4 => {
38
+ let {
39
+ colour,
40
+ theme
41
+ } = _ref4;
42
+ return colour ? theme.color(colour) : theme.color('white');
25
43
  });
26
- const Chevron = _ref2 => {
44
+ const Chevron = _ref5 => {
27
45
  let {
28
46
  colour,
47
+ mobileColour,
29
48
  theme,
30
49
  size,
31
50
  direction,
32
51
  ...rest
33
- } = _ref2;
52
+ } = _ref5;
34
53
  return /*#__PURE__*/_react.default.createElement(Icon, Object.assign({
35
54
  direction: direction,
36
55
  width: size,
37
56
  height: size,
38
57
  fill: theme.color(colour),
58
+ colour: colour,
59
+ mobileColour: mobileColour,
39
60
  xmlns: "http://www.w3.org/2000/svg",
40
61
  viewBox: "0 0 48 48"
41
62
  }, rest), /*#__PURE__*/_react.default.createElement("path", {
@@ -44,6 +65,7 @@ const Chevron = _ref2 => {
44
65
  };
45
66
  Chevron.defaultProps = {
46
67
  colour: 'white',
68
+ mobileColour: null,
47
69
  size: 24,
48
70
  direction: 'up'
49
71
  };
@@ -1,23 +1,49 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = require("styled-components");
10
- const Download = _ref => {
10
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
+ const StyledSVG = _styledComponents.default.svg.withConfig({
12
+ displayName: "Download__StyledSVG",
13
+ componentId: "sc-eoa7se-0"
14
+ })(["fill:", ";@media ", "{fill:", ";}"], _ref => {
11
15
  let {
16
+ mobileColour,
12
17
  colour,
18
+ theme
19
+ } = _ref;
20
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
21
+ }, _ref2 => {
22
+ let {
23
+ theme
24
+ } = _ref2;
25
+ return theme.breakpoint('medium');
26
+ }, _ref3 => {
27
+ let {
28
+ colour,
29
+ theme
30
+ } = _ref3;
31
+ return colour ? theme.color(colour) : theme.color('white');
32
+ });
33
+ const Download = _ref4 => {
34
+ let {
35
+ colour,
36
+ mobileColour,
13
37
  theme,
14
38
  size,
15
39
  ...rest
16
- } = _ref;
17
- return /*#__PURE__*/_react.default.createElement("svg", Object.assign({}, rest, {
40
+ } = _ref4;
41
+ return /*#__PURE__*/_react.default.createElement(StyledSVG, Object.assign({}, rest, {
18
42
  width: size,
19
43
  height: size,
20
44
  fill: theme.color(colour),
45
+ colour: colour,
46
+ mobileColour: mobileColour,
21
47
  xmlns: "http://www.w3.org/2000/svg",
22
48
  viewBox: "0 0 96 96"
23
49
  }), /*#__PURE__*/_react.default.createElement("path", {
@@ -26,6 +52,7 @@ const Download = _ref => {
26
52
  };
27
53
  Download.defaultProps = {
28
54
  colour: 'white',
55
+ mobileColour: null,
29
56
  size: 24
30
57
  };
31
58
  var _default = exports.default = (0, _styledComponents.withTheme)(Download);
@@ -1,23 +1,49 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = require("styled-components");
10
- const External = _ref => {
10
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
+ const StyledSVG = _styledComponents.default.svg.withConfig({
12
+ displayName: "External__StyledSVG",
13
+ componentId: "sc-oha23y-0"
14
+ })(["fill:", ";@media ", "{fill:", ";}"], _ref => {
11
15
  let {
16
+ mobileColour,
12
17
  colour,
18
+ theme
19
+ } = _ref;
20
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
21
+ }, _ref2 => {
22
+ let {
23
+ theme
24
+ } = _ref2;
25
+ return theme.breakpoint('medium');
26
+ }, _ref3 => {
27
+ let {
28
+ colour,
29
+ theme
30
+ } = _ref3;
31
+ return colour ? theme.color(colour) : theme.color('white');
32
+ });
33
+ const External = _ref4 => {
34
+ let {
35
+ colour,
36
+ mobileColour,
13
37
  theme,
14
38
  size,
15
39
  ...rest
16
- } = _ref;
17
- return /*#__PURE__*/_react.default.createElement("svg", Object.assign({}, rest, {
40
+ } = _ref4;
41
+ return /*#__PURE__*/_react.default.createElement(StyledSVG, Object.assign({}, rest, {
18
42
  width: size,
19
43
  height: size,
20
44
  fill: theme.color(colour),
45
+ colour: colour,
46
+ mobileColour: mobileColour,
21
47
  xmlns: "http://www.w3.org/2000/svg",
22
48
  viewBox: "0 0 96 96"
23
49
  }), /*#__PURE__*/_react.default.createElement("path", {
@@ -26,6 +52,7 @@ const External = _ref => {
26
52
  };
27
53
  External.defaultProps = {
28
54
  colour: 'white',
55
+ mobileColour: null,
29
56
  size: 24
30
57
  };
31
58
  var _default = exports.default = (0, _styledComponents.withTheme)(External);
@@ -1,23 +1,49 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = require("styled-components");
10
- const Favourite = _ref => {
10
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
+ const StyledSVG = _styledComponents.default.svg.withConfig({
12
+ displayName: "Favourite__StyledSVG",
13
+ componentId: "sc-16rqg62-0"
14
+ })(["fill:", ";@media ", "{fill:", ";}"], _ref => {
11
15
  let {
16
+ mobileColour,
12
17
  colour,
18
+ theme
19
+ } = _ref;
20
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
21
+ }, _ref2 => {
22
+ let {
23
+ theme
24
+ } = _ref2;
25
+ return theme.breakpoint('medium');
26
+ }, _ref3 => {
27
+ let {
28
+ colour,
29
+ theme
30
+ } = _ref3;
31
+ return colour ? theme.color(colour) : theme.color('white');
32
+ });
33
+ const Favourite = _ref4 => {
34
+ let {
35
+ colour,
36
+ mobileColour,
13
37
  theme,
14
38
  size,
15
39
  ...rest
16
- } = _ref;
17
- return /*#__PURE__*/_react.default.createElement("svg", Object.assign({}, rest, {
40
+ } = _ref4;
41
+ return /*#__PURE__*/_react.default.createElement(StyledSVG, Object.assign({}, rest, {
18
42
  width: size,
19
43
  height: size,
20
44
  fill: theme.color(colour),
45
+ colour: colour,
46
+ mobileColour: mobileColour,
21
47
  xmlns: "http://www.w3.org/2000/svg",
22
48
  viewBox: "0 0 96 96"
23
49
  }), /*#__PURE__*/_react.default.createElement("path", {
@@ -26,6 +52,7 @@ const Favourite = _ref => {
26
52
  };
27
53
  Favourite.defaultProps = {
28
54
  colour: 'white',
55
+ mobileColour: null,
29
56
  size: 24
30
57
  };
31
58
  var _default = exports.default = (0, _styledComponents.withTheme)(Favourite);
@@ -1,23 +1,49 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = require("styled-components");
10
- const Internal = _ref => {
10
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
+ const StyledSVG = _styledComponents.default.svg.withConfig({
12
+ displayName: "Internal__StyledSVG",
13
+ componentId: "sc-166yk4t-0"
14
+ })(["fill:", ";@media ", "{fill:", ";}"], _ref => {
11
15
  let {
16
+ mobileColour,
12
17
  colour,
18
+ theme
19
+ } = _ref;
20
+ return mobileColour ? theme.color(mobileColour) : theme.color(colour);
21
+ }, _ref2 => {
22
+ let {
23
+ theme
24
+ } = _ref2;
25
+ return theme.breakpoint('medium');
26
+ }, _ref3 => {
27
+ let {
28
+ colour,
29
+ theme
30
+ } = _ref3;
31
+ return colour ? theme.color(colour) : theme.color('white');
32
+ });
33
+ const Internal = _ref4 => {
34
+ let {
35
+ colour,
36
+ mobileColour,
13
37
  theme,
14
38
  size,
15
39
  ...rest
16
- } = _ref;
17
- return /*#__PURE__*/_react.default.createElement("svg", Object.assign({}, rest, {
40
+ } = _ref4;
41
+ return /*#__PURE__*/_react.default.createElement(StyledSVG, Object.assign({}, rest, {
18
42
  width: size,
19
43
  height: size,
20
44
  fill: theme.color(colour),
45
+ colour: colour,
46
+ mobileColour: mobileColour,
21
47
  xmlns: "http://www.w3.org/2000/svg",
22
48
  viewBox: "0 0 96 96"
23
49
  }), /*#__PURE__*/_react.default.createElement("path", {
@@ -26,6 +52,7 @@ const Internal = _ref => {
26
52
  };
27
53
  Internal.defaultProps = {
28
54
  colour: 'white',
55
+ mobileColour: null,
29
56
  size: 24
30
57
  };
31
58
  var _default = exports.default = (0, _styledComponents.withTheme)(Internal);
@@ -44,21 +44,22 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
44
44
  href="#anchor"
45
45
  target="blank"
46
46
  type="button"
47
- icon={<Internal colour="white" />}
47
+ icon={<Internal colour="white" mobileColour="red"/>}
48
48
  >
49
- Internal link, 'blue' on tablet and mobile
49
+ Internal link, 'blue' with red icon on tablet and mobile
50
50
  </Link>
51
51
  </div>
52
52
 
53
53
  <div style={{ display: 'block', marginBottom: '10px' }}>
54
54
  <Link
55
- color="red"
55
+ color="blue"
56
+ mobileColour="black"
56
57
  href="#anchor"
57
58
  target="blank"
58
59
  type="button"
59
- icon={<External colour="white" />}
60
+ icon={<External colour="white" mobileColour="blue" />}
60
61
  >
61
- External link
62
+ External link (black on mobile, blue on desktop)
62
63
  </Link>
63
64
  </div>
64
65
 
@@ -68,9 +69,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
68
69
  href="#anchor"
69
70
  target="blank"
70
71
  type="button"
71
- icon={<Download colour="white" />}
72
+ icon={<Download colour="white" mobileColour="blue" />}
72
73
  >
73
- Download link
74
+ Download link (blue mobile-tablet icon, white desktop icon)
74
75
  </Link>
75
76
  </div>
76
77
 
@@ -80,9 +81,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
80
81
  href="#anchor"
81
82
  target="blank"
82
83
  type="button"
83
- icon={<Favourite colour="white" />}
84
+ icon={<Favourite colour="white" mobileColour="blue" />}
84
85
  >
85
- Favourite link
86
+ Favourite link (blue mobile-tablet icon, white desktop icon)
86
87
  </Link>
87
88
  </div>
88
89
 
@@ -92,9 +93,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
92
93
  href="#anchor"
93
94
  target="blank"
94
95
  type="button"
95
- icon={<Chevron direction="up" colour="white" />}
96
+ icon={<Chevron direction="up" colour="white" mobileColour="blue" />}
96
97
  >
97
- Chevron Up
98
+ Chevron Up (blue mobile-tablet icon, white desktop icon)
98
99
  </Link>
99
100
  </div>
100
101
 
@@ -104,9 +105,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
104
105
  href="#anchor"
105
106
  target="blank"
106
107
  type="button"
107
- icon={<Chevron direction="down" colour="white" />}
108
+ icon={<Chevron direction="down" colour="white" mobileColour="blue" />}
108
109
  >
109
- Chevron Down
110
+ Chevron Down (blue mobile-tablet icon, white desktop icon)
110
111
  </Link>
111
112
  </div>
112
113
 
@@ -116,9 +117,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
116
117
  href="#anchor"
117
118
  target="blank"
118
119
  type="button"
119
- icon={<Chevron direction="left" colour="white" />}
120
+ icon={<Chevron direction="left" colour="white" mobileColour="blue" />}
120
121
  >
121
- Chevron Left
122
+ Chevron Left (blue mobile-tablet icon, white desktop icon)
122
123
  </Link>
123
124
  </div>
124
125
 
@@ -128,9 +129,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
128
129
  href="#anchor"
129
130
  target="blank"
130
131
  type="button"
131
- icon={<Chevron direction="right" colour="white" />}
132
+ icon={<Chevron direction="right" colour="white" mobileColour="blue" />}
132
133
  >
133
- Chevron Right
134
+ Chevron Right (blue mobile-tablet icon, white desktop icon)
134
135
  </Link>
135
136
  </div>
136
137
 
@@ -141,9 +142,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
141
142
  target="blank"
142
143
  type="button"
143
144
  iconFirst
144
- icon={<Arrow direction="left" colour="white" />}
145
+ icon={<Arrow direction="left" colour="white" mobileColour="blue" />}
145
146
  >
146
- Arrow Left
147
+ Arrow Left (blue mobile-tablet icon, white desktop icon)
147
148
  </Link>
148
149
  </div>
149
150
 
@@ -153,9 +154,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
153
154
  href="#anchor"
154
155
  target="blank"
155
156
  type="button"
156
- icon={<AtSign />}
157
+ icon={<AtSign colour="white" mobileColour="blue" />}
157
158
  >
158
- At Sign
159
+ At Sign (blue mobile-tablet icon, white desktop icon)
159
160
  </Link>
160
161
  </div>
161
162
  </div>;
@@ -22,7 +22,7 @@ it("renders a button with an icon", () => {
22
22
  colour: "white"
23
23
  })
24
24
  }, "Internal link")).toJSON();
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 ");
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 .c2 {\n fill: #FFFFFF;\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 @media (min-width:1024px) {\n .c2 {\n fill: #FFFFFF;\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 className=\"c2\"\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
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, {
@@ -20,6 +20,7 @@ exports[`renders correctly 1`] = `
20
20
  -webkit-transform: rotate(180deg);
21
21
  -ms-transform: rotate(180deg);
22
22
  transform: rotate(180deg);
23
+ fill: #000000;
23
24
  }
24
25
 
25
26
  .c0 {
@@ -88,6 +89,12 @@ exports[`renders correctly 1`] = `
88
89
  padding: 0 2rem;
89
90
  }
90
91
 
92
+ @media (min-width:1024px) {
93
+ .c4 {
94
+ fill: #000000;
95
+ }
96
+ }
97
+
91
98
  @media (min-width:740px) {
92
99
  .c1 {
93
100
  padding: 2rem 3rem;
@@ -115,6 +115,10 @@ exports[`renders correctly 1`] = `
115
115
  z-index: 2;
116
116
  }
117
117
 
118
+ .c9 {
119
+ fill: #FFFFFF;
120
+ }
121
+
118
122
  @media (min-width:740px) {
119
123
  .c8 {
120
124
  width: auto;
@@ -201,6 +205,12 @@ exports[`renders correctly 1`] = `
201
205
  }
202
206
  }
203
207
 
208
+ @media (min-width:1024px) {
209
+ .c9 {
210
+ fill: #FFFFFF;
211
+ }
212
+ }
213
+
204
214
  <div
205
215
  className="c0"
206
216
  >
@@ -258,6 +268,7 @@ exports[`renders correctly 1`] = `
258
268
  type="button"
259
269
  >
260
270
  <svg
271
+ className="c9"
261
272
  fill="#FFFFFF"
262
273
  height={24}
263
274
  viewBox="0 0 96 96"
@@ -79,6 +79,10 @@ exports[`renders correctly 1`] = `
79
79
  color: #FFFFFF;
80
80
  }
81
81
 
82
+ .c13 {
83
+ fill: #FFFFFF;
84
+ }
85
+
82
86
  .c0 {
83
87
  display: -webkit-box;
84
88
  display: -webkit-flex;
@@ -175,6 +179,12 @@ exports[`renders correctly 1`] = `
175
179
  }
176
180
  }
177
181
 
182
+ @media (min-width:1024px) {
183
+ .c13 {
184
+ fill: #FFFFFF;
185
+ }
186
+ }
187
+
178
188
  @media (min-width:740px) {
179
189
  .c0 {
180
190
  -webkit-flex-direction: row;
@@ -310,6 +320,7 @@ exports[`renders correctly 1`] = `
310
320
  type="button"
311
321
  >
312
322
  <svg
323
+ className="c13"
313
324
  fill="#FFFFFF"
314
325
  height={24}
315
326
  viewBox="0 0 96 96"
@@ -9,7 +9,7 @@ var _styledComponents = require("styled-components");
9
9
  var _colors = _interopRequireDefault(require("./colors"));
10
10
  const buttonColors = {
11
11
  black: {
12
- background: (0, _colors.default)('grey_dark'),
12
+ background: (0, _colors.default)('black'),
13
13
  color: (0, _colors.default)('white'),
14
14
  hoverBackground: (0, _colors.default)('grey'),
15
15
  hoverColor: (0, _colors.default)('white')
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.36.0",
4
+ "version": "7.37.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -11,16 +11,25 @@ const angle = {
11
11
 
12
12
  const Icon = styled.svg`
13
13
  transform: ${({ direction }) => `rotate(${angle[direction]})`};
14
+
15
+ // Mobile-colour if available, else use standard prop
16
+ fill: ${({ mobileColour, colour, theme }) => (mobileColour ? theme.color(mobileColour) : theme.color(colour))};
17
+
18
+ // Reinstate standard styles for 'desktop', adding a fallback for good measure:
19
+ @media ${({ theme }) => theme.breakpoint('medium')} {
20
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
21
+ }
14
22
  `;
15
23
 
16
24
  const Arrow = ({
17
- colour, theme, size, direction, ...rest
25
+ colour, mobileColour, theme, size, direction, ...rest
18
26
  }) => (
19
27
  <Icon
20
28
  direction={direction}
21
29
  width={size}
22
30
  height={size}
23
- fill={theme.color(colour)}
31
+ colour={colour}
32
+ mobileColour={mobileColour}
24
33
  xmlns="http://www.w3.org/2000/svg"
25
34
  viewBox="0 0 96 96"
26
35
  {...rest}
@@ -31,6 +40,7 @@ const Arrow = ({
31
40
 
32
41
  Arrow.propTypes = {
33
42
  colour: PropTypes.string,
43
+ mobileColour: PropTypes.string,
34
44
  size: PropTypes.number,
35
45
  direction: PropTypes.oneOf(['up', 'down', 'left', 'right']),
36
46
  theme: PropTypes.objectOf(PropTypes.shape).isRequired
@@ -38,6 +48,7 @@ Arrow.propTypes = {
38
48
 
39
49
  Arrow.defaultProps = {
40
50
  colour: 'white',
51
+ mobileColour: null,
41
52
  size: 24,
42
53
  direction: 'up'
43
54
  };
@@ -1,32 +1,45 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withTheme } from 'styled-components';
3
+ import styled, { withTheme } from 'styled-components';
4
4
 
5
5
  const PATH_DATA = 'M40.811,9.307C36.607,4.664,30.48,2,24,2C11.458,2,2,11.458,2,24s9.458,22,22,22c10.221,0,14.032-3.779,15.29-5.031 c0.197-0.115,0.379-0.265,0.533-0.451c0.707-0.849,0.592-2.11-0.257-2.817c-0.438-0.362-1.61-1.049-3.093,0.427 C35.512,39.086,32.585,42,24,42C13.738,42,6,34.262,6,24S13.738,6,24,6c5.353,0,10.398,2.184,13.845,5.991 c3.162,3.495,4.642,8.044,4.165,12.81c-0.364,3.641-1.958,6.013-4.487,6.677c-1.853,0.487-3.658-0.145-4.269-1.011 c-1.001-1.422-0.753-4.747,0.009-8.237c1.035-3.375,2.104-6.939,2.177-7.179c0.308-1.027-0.249-2.114-1.263-2.465 c-1.012-0.349-2.122,0.161-2.515,1.159c-0.097,0.247-0.191,0.491-0.282,0.732c-1.427-1.455-3.424-2.421-5.724-2.66 c-3.983-0.41-9.547,1.602-12.107,8.643c-1.334,3.667-1.19,7.467,0.384,10.163c1.241,2.126,3.291,3.482,5.929,3.921 c4.299,0.714,7.438-0.837,9.464-3.098c0.254,0.695,0.516,1.122,0.659,1.325c1.66,2.358,5.257,3.443,8.555,2.576 c1.987-0.522,6.691-2.557,7.451-10.147C46.581,19.295,44.741,13.651,40.811,9.307z M37.871,41.195 c-0.149-0.03-0.3-0.081-0.448-0.152C37.567,41.112,37.718,41.163,37.871,41.195z M29.195,21.849 c-0.554,1.799-1.07,3.451-1.379,4.375c-0.413,1.243-2.174,5.229-7.297,4.374c-1.468-0.245-2.493-0.896-3.133-1.993 c-0.967-1.657-0.997-4.254-0.078-6.779c1.633-4.492,4.727-6.064,7.296-6.064c0.217,0,0.431,0.011,0.639,0.033 c1.952,0.203,4.068,1.433,4.396,3.726c0.01,0.074,0.024,0.146,0.043,0.217C29.49,20.479,29.329,21.181,29.195,21.849z';
6
6
 
7
+ const StyledSVG = styled.svg`
8
+ // Mobile-colour if available, else use standard prop
9
+ fill: ${({ mobileColour, colour, theme }) => (mobileColour ? theme.color(mobileColour) : theme.color(colour))};
10
+
11
+ // Reinstate standard styles for 'desktop', adding a fallback for good measure:
12
+ @media ${({ theme }) => theme.breakpoint('medium')} {
13
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
14
+ }
15
+ `;
16
+
7
17
  const AtSign = ({
8
- theme, size, colour, ...rest
18
+ theme, size, colour, mobileColour, ...rest
9
19
  }) => (
10
- <svg
20
+ <StyledSVG
11
21
  width={size}
12
22
  height={size}
13
- fill={theme.color(colour)}
23
+ colour={colour}
24
+ mobileColour={mobileColour}
14
25
  viewBox="0 0 48 48"
15
26
  {...rest}
16
27
  >
17
28
  <path d={PATH_DATA} />
18
- </svg>
29
+ </StyledSVG>
19
30
  );
20
31
 
21
32
  AtSign.propTypes = {
22
33
  theme: PropTypes.objectOf(PropTypes.shape).isRequired,
23
34
  size: PropTypes.number,
24
- colour: PropTypes.string
35
+ colour: PropTypes.string,
36
+ mobileColour: PropTypes.string
25
37
  };
26
38
 
27
39
  AtSign.defaultProps = {
28
40
  size: 24,
29
- colour: 'white'
41
+ colour: 'white',
42
+ mobileColour: null
30
43
  };
31
44
 
32
45
  export default withTheme(AtSign);
@@ -11,16 +11,26 @@ const angle = {
11
11
 
12
12
  const Icon = styled.svg`
13
13
  transform: ${({ direction }) => `rotate(${angle[direction]})`};
14
+
15
+ // Mobile-colour if available, else use standard prop
16
+ fill: ${({ mobileColour, colour, theme }) => (mobileColour ? theme.color(mobileColour) : theme.color(colour))};
17
+
18
+ // Reinstate standard styles for 'desktop', adding a fallback for good measure:
19
+ @media ${({ theme }) => theme.breakpoint('medium')} {
20
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
21
+ }
14
22
  `;
15
23
 
16
24
  const Chevron = ({
17
- colour, theme, size, direction, ...rest
25
+ colour, mobileColour, theme, size, direction, ...rest
18
26
  }) => (
19
27
  <Icon
20
28
  direction={direction}
21
29
  width={size}
22
30
  height={size}
23
31
  fill={theme.color(colour)}
32
+ colour={colour}
33
+ mobileColour={mobileColour}
24
34
  xmlns="http://www.w3.org/2000/svg"
25
35
  viewBox="0 0 48 48"
26
36
  {...rest}
@@ -31,6 +41,7 @@ const Chevron = ({
31
41
 
32
42
  Chevron.propTypes = {
33
43
  colour: PropTypes.string,
44
+ mobileColour: PropTypes.string,
34
45
  size: PropTypes.number,
35
46
  direction: PropTypes.oneOf(['up', 'down', 'left', 'right']),
36
47
  theme: PropTypes.objectOf(PropTypes.shape).isRequired
@@ -38,6 +49,7 @@ Chevron.propTypes = {
38
49
 
39
50
  Chevron.defaultProps = {
40
51
  colour: 'white',
52
+ mobileColour: null,
41
53
  size: 24,
42
54
  direction: 'up'
43
55
  };
@@ -1,30 +1,44 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withTheme } from 'styled-components';
3
+ import styled, { withTheme } from 'styled-components';
4
+
5
+ const StyledSVG = styled.svg`
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.breakpoint('medium')} {
11
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
12
+ }
13
+ `;
4
14
 
5
15
  const Download = ({
6
- colour, theme, size, ...rest
16
+ colour, mobileColour, theme, size, ...rest
7
17
  }) => (
8
- <svg
18
+ <StyledSVG
9
19
  {...rest}
10
20
  width={size}
11
21
  height={size}
12
22
  fill={theme.color(colour)}
23
+ colour={colour}
24
+ mobileColour={mobileColour}
13
25
  xmlns="http://www.w3.org/2000/svg"
14
26
  viewBox="0 0 96 96"
15
27
  >
16
28
  <path d="M17.171 38.829a4 4 0 015.657-5.657L44 54.343V8a4 4 0 018 0v46.343l21.172-21.172a4 4 0 115.656 5.657l-28 28-.005.004a3.976 3.976 0 01-.604.493c-.101.068-.211.115-.317.172-.123.067-.241.141-.372.195-.133.055-.273.087-.41.127-.113.033-.22.077-.337.1a3.89 3.89 0 01-1.566.002c-.116-.023-.224-.067-.336-.1-.138-.04-.277-.072-.411-.128-.13-.054-.248-.128-.37-.195-.106-.058-.216-.105-.318-.173a4.037 4.037 0 01-.604-.493l-.005-.004-28.002-27.999zM84 68a4 4 0 00-4 4v12H16V72a4 4 0 00-8 0v16a4 4 0 004 4h72a4 4 0 004-4V72a4 4 0 00-4-4z" />
17
- </svg>
29
+ </StyledSVG>
18
30
  );
19
31
 
20
32
  Download.propTypes = {
21
33
  colour: PropTypes.string,
34
+ mobileColour: PropTypes.string,
22
35
  size: PropTypes.number,
23
36
  theme: PropTypes.objectOf(PropTypes.shape).isRequired
24
37
  };
25
38
 
26
39
  Download.defaultProps = {
27
40
  colour: 'white',
41
+ mobileColour: null,
28
42
  size: 24
29
43
  };
30
44
 
@@ -1,30 +1,44 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withTheme } from 'styled-components';
3
+ import styled, { withTheme } from 'styled-components';
4
+
5
+ const StyledSVG = styled.svg`
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.breakpoint('medium')} {
11
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
12
+ }
13
+ `;
4
14
 
5
15
  const External = ({
6
- colour, theme, size, ...rest
16
+ colour, mobileColour, theme, size, ...rest
7
17
  }) => (
8
- <svg
18
+ <StyledSVG
9
19
  {...rest}
10
20
  width={size}
11
21
  height={size}
12
22
  fill={theme.color(colour)}
23
+ colour={colour}
24
+ mobileColour={mobileColour}
13
25
  xmlns="http://www.w3.org/2000/svg"
14
26
  viewBox="0 0 96 96"
15
27
  >
16
28
  <path d="M92 8.001V48a4 4 0 01-8 0V17.657L50.899 50.758c-.781.781-1.805 1.171-2.829 1.171s-2.047-.391-2.829-1.171a4 4 0 010-5.657L78.343 12H48a4 4 0 010-8h40c.016 0 .032.005.048.005.246.003.492.026.734.074.121.024.233.069.35.104.133.039.268.07.397.123.132.055.253.13.377.198.104.057.212.103.312.169.201.134.386.289.559.456.016.016.035.026.051.042.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.327.052.259.08.522.08.785zM72 68a4 4 0 00-4 4v12H12V28h12a4 4 0 000-8H8a4 4 0 00-4 4v64a4 4 0 004 4h64a4 4 0 004-4V72a4 4 0 00-4-4z" />
17
- </svg>
29
+ </StyledSVG>
18
30
  );
19
31
 
20
32
  External.propTypes = {
21
33
  colour: PropTypes.string,
34
+ mobileColour: PropTypes.string,
22
35
  size: PropTypes.number,
23
36
  theme: PropTypes.objectOf(PropTypes.shape).isRequired
24
37
  };
25
38
 
26
39
  External.defaultProps = {
27
40
  colour: 'white',
41
+ mobileColour: null,
28
42
  size: 24
29
43
  };
30
44
 
@@ -1,30 +1,44 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withTheme } from 'styled-components';
3
+ import styled, { withTheme } from 'styled-components';
4
+
5
+ const StyledSVG = styled.svg`
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.breakpoint('medium')} {
11
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
12
+ }
13
+ `;
4
14
 
5
15
  const Favourite = ({
6
- colour, theme, size, ...rest
16
+ colour, mobileColour, theme, size, ...rest
7
17
  }) => (
8
- <svg
18
+ <StyledSVG
9
19
  {...rest}
10
20
  width={size}
11
21
  height={size}
12
22
  fill={theme.color(colour)}
23
+ colour={colour}
24
+ mobileColour={mobileColour}
13
25
  xmlns="http://www.w3.org/2000/svg"
14
26
  viewBox="0 0 96 96"
15
27
  >
16
28
  <path d="M74.295 8.47C64.301 6.55 54.06 10.592 48 18.198 41.94 10.592 31.698 6.55 21.705 8.47 12.179 10.304 2 18.229 2 34.973 2 52.345 19.988 67.357 34.442 79.42c4.113 3.432 7.997 6.674 10.729 9.407l.001.001.001.001c.091.091.196.159.294.24.111.092.216.195.333.272.095.063.199.103.298.157.132.072.26.153.397.209.142.058.291.089.438.13.102.028.2.07.303.09a4.003 4.003 0 001.528 0l.012-.003c.5-.098.985-.292 1.426-.583l.021-.017c.213-.143.417-.306.605-.494l.001-.001.001-.001c2.732-2.733 6.616-5.975 10.729-9.407C76.012 67.357 94 52.345 94 34.973 94 18.229 83.821 10.304 74.295 8.47zM56.432 73.278c-3.029 2.528-5.93 4.952-8.432 7.219-2.502-2.267-5.403-4.692-8.432-7.219C27.09 62.864 10 48.602 10 34.973c0-14.534 9.243-17.882 13.216-18.647 7.468-1.438 17.384 1.981 21.047 11.146a3.987 3.987 0 003.017 2.443c.065.012.129.014.193.023.175.023.35.043.528.042.17.001.336-.019.502-.04.073-.01.146-.012.219-.026a3.99 3.99 0 003.014-2.442c3.663-9.165 13.578-12.584 21.047-11.146C76.757 17.091 86 20.439 86 34.973c0 13.629-17.09 27.891-29.568 38.305z" />
17
- </svg>
29
+ </StyledSVG>
18
30
  );
19
31
 
20
32
  Favourite.propTypes = {
21
33
  colour: PropTypes.string,
34
+ mobileColour: PropTypes.string,
22
35
  size: PropTypes.number,
23
36
  theme: PropTypes.objectOf(PropTypes.shape).isRequired
24
37
  };
25
38
 
26
39
  Favourite.defaultProps = {
27
40
  colour: 'white',
41
+ mobileColour: null,
28
42
  size: 24
29
43
  };
30
44
 
@@ -1,30 +1,44 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withTheme } from 'styled-components';
3
+ import styled, { withTheme } from 'styled-components';
4
+
5
+ const StyledSVG = styled.svg`
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.breakpoint('medium')} {
11
+ fill: ${({ colour, theme }) => (colour ? theme.color(colour) : theme.color('white'))};
12
+ }
13
+ `;
4
14
 
5
15
  const Internal = ({
6
- colour, theme, size, ...rest
16
+ colour, mobileColour, theme, size, ...rest
7
17
  }) => (
8
- <svg
18
+ <StyledSVG
9
19
  {...rest}
10
20
  width={size}
11
21
  height={size}
12
22
  fill={theme.color(colour)}
23
+ colour={colour}
24
+ mobileColour={mobileColour}
13
25
  xmlns="http://www.w3.org/2000/svg"
14
26
  viewBox="0 0 96 96"
15
27
  >
16
28
  <path 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" />
17
- </svg>
29
+ </StyledSVG>
18
30
  );
19
31
 
20
32
  Internal.propTypes = {
21
33
  colour: PropTypes.string,
34
+ mobileColour: PropTypes.string,
22
35
  size: PropTypes.number,
23
36
  theme: PropTypes.objectOf(PropTypes.shape).isRequired
24
37
  };
25
38
 
26
39
  Internal.defaultProps = {
27
40
  colour: 'white',
41
+ mobileColour: null,
28
42
  size: 24
29
43
  };
30
44
 
@@ -44,21 +44,22 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
44
44
  href="#anchor"
45
45
  target="blank"
46
46
  type="button"
47
- icon={<Internal colour="white" />}
47
+ icon={<Internal colour="white" mobileColour="red"/>}
48
48
  >
49
- Internal link, 'blue' on tablet and mobile
49
+ Internal link, 'blue' with red icon on tablet and mobile
50
50
  </Link>
51
51
  </div>
52
52
 
53
53
  <div style={{ display: 'block', marginBottom: '10px' }}>
54
54
  <Link
55
- color="red"
55
+ color="blue"
56
+ mobileColour="black"
56
57
  href="#anchor"
57
58
  target="blank"
58
59
  type="button"
59
- icon={<External colour="white" />}
60
+ icon={<External colour="white" mobileColour="blue" />}
60
61
  >
61
- External link
62
+ External link (black on mobile, blue on desktop)
62
63
  </Link>
63
64
  </div>
64
65
 
@@ -68,9 +69,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
68
69
  href="#anchor"
69
70
  target="blank"
70
71
  type="button"
71
- icon={<Download colour="white" />}
72
+ icon={<Download colour="white" mobileColour="blue" />}
72
73
  >
73
- Download link
74
+ Download link (blue mobile-tablet icon, white desktop icon)
74
75
  </Link>
75
76
  </div>
76
77
 
@@ -80,9 +81,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
80
81
  href="#anchor"
81
82
  target="blank"
82
83
  type="button"
83
- icon={<Favourite colour="white" />}
84
+ icon={<Favourite colour="white" mobileColour="blue" />}
84
85
  >
85
- Favourite link
86
+ Favourite link (blue mobile-tablet icon, white desktop icon)
86
87
  </Link>
87
88
  </div>
88
89
 
@@ -92,9 +93,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
92
93
  href="#anchor"
93
94
  target="blank"
94
95
  type="button"
95
- icon={<Chevron direction="up" colour="white" />}
96
+ icon={<Chevron direction="up" colour="white" mobileColour="blue" />}
96
97
  >
97
- Chevron Up
98
+ Chevron Up (blue mobile-tablet icon, white desktop icon)
98
99
  </Link>
99
100
  </div>
100
101
 
@@ -104,9 +105,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
104
105
  href="#anchor"
105
106
  target="blank"
106
107
  type="button"
107
- icon={<Chevron direction="down" colour="white" />}
108
+ icon={<Chevron direction="down" colour="white" mobileColour="blue" />}
108
109
  >
109
- Chevron Down
110
+ Chevron Down (blue mobile-tablet icon, white desktop icon)
110
111
  </Link>
111
112
  </div>
112
113
 
@@ -116,9 +117,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
116
117
  href="#anchor"
117
118
  target="blank"
118
119
  type="button"
119
- icon={<Chevron direction="left" colour="white" />}
120
+ icon={<Chevron direction="left" colour="white" mobileColour="blue" />}
120
121
  >
121
- Chevron Left
122
+ Chevron Left (blue mobile-tablet icon, white desktop icon)
122
123
  </Link>
123
124
  </div>
124
125
 
@@ -128,9 +129,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
128
129
  href="#anchor"
129
130
  target="blank"
130
131
  type="button"
131
- icon={<Chevron direction="right" colour="white" />}
132
+ icon={<Chevron direction="right" colour="white" mobileColour="blue" />}
132
133
  >
133
- Chevron Right
134
+ Chevron Right (blue mobile-tablet icon, white desktop icon)
134
135
  </Link>
135
136
  </div>
136
137
 
@@ -141,9 +142,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
141
142
  target="blank"
142
143
  type="button"
143
144
  iconFirst
144
- icon={<Arrow direction="left" colour="white" />}
145
+ icon={<Arrow direction="left" colour="white" mobileColour="blue" />}
145
146
  >
146
- Arrow Left
147
+ Arrow Left (blue mobile-tablet icon, white desktop icon)
147
148
  </Link>
148
149
  </div>
149
150
 
@@ -153,9 +154,9 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
153
154
  href="#anchor"
154
155
  target="blank"
155
156
  type="button"
156
- icon={<AtSign />}
157
+ icon={<AtSign colour="white" mobileColour="blue" />}
157
158
  >
158
- At Sign
159
+ At Sign (blue mobile-tablet icon, white desktop icon)
159
160
  </Link>
160
161
  </div>
161
162
  </div>;
@@ -85,6 +85,10 @@ it("renders a button with an icon", () => {
85
85
  border-bottom: 2px solid #000000;
86
86
  }
87
87
 
88
+ .c2 {
89
+ fill: #FFFFFF;
90
+ }
91
+
88
92
  @media (min-width:740px) {
89
93
  .c1 {
90
94
  width: auto;
@@ -97,6 +101,12 @@ it("renders a button with an icon", () => {
97
101
  }
98
102
  }
99
103
 
104
+ @media (min-width:1024px) {
105
+ .c2 {
106
+ fill: #FFFFFF;
107
+ }
108
+ }
109
+
100
110
  <a
101
111
  className="c0"
102
112
  color="red"
@@ -110,6 +120,7 @@ it("renders a button with an icon", () => {
110
120
  type="standard"
111
121
  >
112
122
  <svg
123
+ className="c2"
113
124
  fill="#FFFFFF"
114
125
  height={24}
115
126
  viewBox="0 0 96 96"
@@ -20,6 +20,7 @@ exports[`renders correctly 1`] = `
20
20
  -webkit-transform: rotate(180deg);
21
21
  -ms-transform: rotate(180deg);
22
22
  transform: rotate(180deg);
23
+ fill: #000000;
23
24
  }
24
25
 
25
26
  .c0 {
@@ -88,6 +89,12 @@ exports[`renders correctly 1`] = `
88
89
  padding: 0 2rem;
89
90
  }
90
91
 
92
+ @media (min-width:1024px) {
93
+ .c4 {
94
+ fill: #000000;
95
+ }
96
+ }
97
+
91
98
  @media (min-width:740px) {
92
99
  .c1 {
93
100
  padding: 2rem 3rem;
@@ -115,6 +115,10 @@ exports[`renders correctly 1`] = `
115
115
  z-index: 2;
116
116
  }
117
117
 
118
+ .c9 {
119
+ fill: #FFFFFF;
120
+ }
121
+
118
122
  @media (min-width:740px) {
119
123
  .c8 {
120
124
  width: auto;
@@ -201,6 +205,12 @@ exports[`renders correctly 1`] = `
201
205
  }
202
206
  }
203
207
 
208
+ @media (min-width:1024px) {
209
+ .c9 {
210
+ fill: #FFFFFF;
211
+ }
212
+ }
213
+
204
214
  <div
205
215
  className="c0"
206
216
  >
@@ -258,6 +268,7 @@ exports[`renders correctly 1`] = `
258
268
  type="button"
259
269
  >
260
270
  <svg
271
+ className="c9"
261
272
  fill="#FFFFFF"
262
273
  height={24}
263
274
  viewBox="0 0 96 96"
@@ -79,6 +79,10 @@ exports[`renders correctly 1`] = `
79
79
  color: #FFFFFF;
80
80
  }
81
81
 
82
+ .c13 {
83
+ fill: #FFFFFF;
84
+ }
85
+
82
86
  .c0 {
83
87
  display: -webkit-box;
84
88
  display: -webkit-flex;
@@ -175,6 +179,12 @@ exports[`renders correctly 1`] = `
175
179
  }
176
180
  }
177
181
 
182
+ @media (min-width:1024px) {
183
+ .c13 {
184
+ fill: #FFFFFF;
185
+ }
186
+ }
187
+
178
188
  @media (min-width:740px) {
179
189
  .c0 {
180
190
  -webkit-flex-direction: row;
@@ -310,6 +320,7 @@ exports[`renders correctly 1`] = `
310
320
  type="button"
311
321
  >
312
322
  <svg
323
+ className="c13"
313
324
  fill="#FFFFFF"
314
325
  height={24}
315
326
  viewBox="0 0 96 96"
@@ -3,7 +3,7 @@ import color from './colors';
3
3
 
4
4
  const buttonColors = {
5
5
  black: {
6
- background: color('grey_dark'),
6
+ background: color('black'),
7
7
  color: color('white'),
8
8
  hoverBackground: color('grey'),
9
9
  hoverColor: color('white')