@comicrelief/component-library 7.39.0 → 7.41.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 (26) hide show
  1. package/dist/components/Atoms/Picture/Picture.js +49 -6
  2. package/dist/components/Atoms/Picture/Picture.test.js +2 -2
  3. package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +2 -2
  4. package/dist/components/Molecules/Card/Card.js +20 -28
  5. package/dist/components/Molecules/Card/Card.md +71 -3
  6. package/dist/components/Molecules/Card/Card.style.js +74 -0
  7. package/dist/components/Molecules/Card/Card.test.js +10 -0
  8. package/dist/components/Molecules/Card/__snapshots__/Card.test.js.snap +113 -7
  9. package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +1 -1
  10. package/dist/index.js +7 -0
  11. package/dist/theme/shared/allContainers.js +2 -2
  12. package/package.json +1 -1
  13. package/src/components/Atoms/Picture/Picture.js +50 -5
  14. package/src/components/Atoms/Picture/Picture.test.js +12 -8
  15. package/src/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +7 -7
  16. package/src/components/Molecules/Card/Card.js +29 -28
  17. package/src/components/Molecules/Card/Card.md +71 -3
  18. package/src/components/Molecules/Card/Card.style.js +77 -0
  19. package/src/components/Molecules/Card/Card.test.js +17 -0
  20. package/src/components/Molecules/Card/__snapshots__/Card.test.js.snap +113 -7
  21. package/src/components/Molecules/PartnerLink/PartnerLink.test.js +12 -8
  22. package/src/components/Molecules/Promo/Promo.style.js +2 -2
  23. package/src/components/Molecules/SingleMessage/SingleMessage.style.js +2 -2
  24. package/src/components/Organisms/Header/Header.style.js +2 -2
  25. package/src/index.js +1 -0
  26. package/src/theme/shared/allContainers.js +2 -2
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
@@ -7,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireWildcard(require("react"));
9
10
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
+ var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
10
12
  require("lazysizes");
11
13
  require("lazysizes/plugins/blur-up/ls.blur-up");
12
14
  // Transparent pixel png
@@ -29,17 +31,52 @@ const Wrapper = _styledComponents.default.div.withConfig({
29
31
  const Image = _styledComponents.default.img.withConfig({
30
32
  displayName: "Picture__Image",
31
33
  componentId: "sc-1x3z81z-1"
32
- })(["width:", ";height:", ";display:block;object-fit:", ";", ";"], props => props.width ? props.width : '100%', props => props.height ? props.height : 'auto', props => props.objectFit === 'none' && 'none' || props.objectFit === 'cover' && 'cover' || props.objectFit === 'contain' && 'contain', _ref3 => {
34
+ })(["width:", ";height:", ";display:block;object-fit:", ";", ";", " ", " ", ""], props => props.width ? props.width : '100%', props => props.height ? props.height : 'auto', props => props.objectFit === 'none' && 'none' || props.objectFit === 'cover' && 'cover' || props.objectFit === 'contain' && 'contain', _ref3 => {
33
35
  let {
34
36
  objectFit,
35
37
  objFitState
36
38
  } = _ref3;
37
39
  return objectFit !== 'none' && !objFitState && 'visibility: hidden;';
40
+ }, _ref4 => {
41
+ let {
42
+ smallBreakpointRowLayout
43
+ } = _ref4;
44
+ return smallBreakpointRowLayout === true && (0, _styledComponents.css)(["@media ", "{padding:", ";border-radius:", ";width:110px;height:110px;}@media ", "{padding:none;border-radius:none;width:", ";height:", ";}"], _ref5 => {
45
+ let {
46
+ theme
47
+ } = _ref5;
48
+ return theme.allBreakpoints('S');
49
+ }, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), _ref6 => {
50
+ let {
51
+ theme
52
+ } = _ref6;
53
+ return theme.allBreakpoints('M');
54
+ }, props => props.width ? props.width : '100%', props => props.height ? props.height : 'auto');
55
+ }, _ref7 => {
56
+ let {
57
+ mediumBreakpointRowLayout
58
+ } = _ref7;
59
+ return mediumBreakpointRowLayout === true && (0, _styledComponents.css)(["@media ", "{padding:", ";border-radius:", ";width:120px;height:120px;}"], _ref8 => {
60
+ let {
61
+ theme
62
+ } = _ref8;
63
+ return theme.allBreakpoints('M');
64
+ }, (0, _spacing.default)('sm'), (0, _spacing.default)('md'));
65
+ }, _ref9 => {
66
+ let {
67
+ smallBreakpointRowLayout,
68
+ mediumBreakpointRowLayout
69
+ } = _ref9;
70
+ return (smallBreakpointRowLayout === true || mediumBreakpointRowLayout === true) && (0, _styledComponents.css)(["@media ", "{padding:none;border-radius:none;width:", ";height:", ";}"], _ref10 => {
71
+ let {
72
+ theme
73
+ } = _ref10;
74
+ return theme.allBreakpoints('L');
75
+ }, props => props.width ? props.width : '100%', props => props.height ? props.height : 'auto');
38
76
  });
39
77
 
40
78
  /** Responsive Picture */
41
-
42
- const Picture = _ref4 => {
79
+ const Picture = _ref11 => {
43
80
  let {
44
81
  images,
45
82
  image,
@@ -49,8 +86,10 @@ const Picture = _ref4 => {
49
86
  objectFit,
50
87
  imageLow,
51
88
  isBackgroundImage,
89
+ smallBreakpointRowLayout,
90
+ mediumBreakpointRowLayout,
52
91
  ...rest
53
- } = _ref4;
92
+ } = _ref11;
54
93
  const document = typeof window !== 'undefined' ? window.document : null;
55
94
  const [objFitState, setObjFitState] = (0, _react.useState)(true);
56
95
  let nonObjFitImage = null;
@@ -108,7 +147,9 @@ const Picture = _ref4 => {
108
147
  "data-sizes": "auto",
109
148
  "data-lowsrc": imageLow,
110
149
  className: "lazyload",
111
- objFitState: objFitState
150
+ objFitState: objFitState,
151
+ smallBreakpointRowLayout: smallBreakpointRowLayout,
152
+ mediumBreakpointRowLayout: mediumBreakpointRowLayout
112
153
  }));
113
154
  };
114
155
  Picture.defaultProps = {
@@ -119,6 +160,8 @@ Picture.defaultProps = {
119
160
  width: '100%',
120
161
  height: 'auto',
121
162
  alt: '',
122
- isBackgroundImage: false
163
+ isBackgroundImage: false,
164
+ smallBreakpointRowLayout: null,
165
+ mediumBreakpointRowLayout: null
123
166
  };
124
167
  var _default = exports.default = (0, _styledComponents.withTheme)(Picture);
@@ -6,7 +6,7 @@ require("jest-styled-components");
6
6
  var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
7
7
  var _Picture = _interopRequireDefault(require("./Picture"));
8
8
  var _data = require("../../../styleguide/data/data");
9
- it('renders correctly', () => {
9
+ it("renders correctly", () => {
10
10
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Picture.default, {
11
11
  images: _data.defaultData.images,
12
12
  image: _data.defaultData.image,
@@ -14,7 +14,7 @@ it('renders correctly', () => {
14
14
  })).toJSON();
15
15
  expect(tree).toMatchInlineSnapshot("\n .c0 {\n display: block;\n width: 100%;\n height: auto;\n position: relative;\n }\n\n .c1 {\n width: 100%;\n height: auto;\n display: block;\n object-fit: none;\n }\n\n <div\n className=\"c0 lazyload\"\n height=\"auto\"\n width=\"100%\"\n >\n <img\n alt=\"Test images\"\n className=\"c1 lazyload\"\n data-lowsrc={null}\n data-sizes=\"auto\"\n data-src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n data-srcset=\"//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w\"\n height=\"auto\"\n src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n srcSet=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n width=\"100%\"\n />\n </div>\n ");
16
16
  });
17
- it('renders correctly with custom props', () => {
17
+ it("renders correctly with custom props", () => {
18
18
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Picture.default, {
19
19
  images: _data.defaultData.images,
20
20
  image: _data.defaultData.image,
@@ -6,7 +6,7 @@ require("jest-styled-components");
6
6
  var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
7
7
  var _ArticleTeaser = _interopRequireDefault(require("./ArticleTeaser"));
8
8
  var _data = require("../../../styleguide/data/data");
9
- it('renders article teaser correctly', () => {
9
+ it("renders article teaser correctly", () => {
10
10
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_ArticleTeaser.default, {
11
11
  href: "/test",
12
12
  images: _data.defaultData.images,
@@ -20,7 +20,7 @@ it('renders article teaser correctly', () => {
20
20
  })).toJSON();
21
21
  expect(tree).toMatchInlineSnapshot("\n .c8 {\n font-size: 0.75rem;\n line-height: 0.75rem;\n text-transform: inherit;\n font-weight: bold;\n line-height: normal;\n font-family: 'Montserrat',Helvetica,Arial,sans-serif;\n }\n\n .c10 {\n font-size: 2rem;\n line-height: 2rem;\n text-transform: uppercase;\n font-weight: normal;\n line-height: 2rem;\n font-family: 'Anton',Impact,sans-serif;\n -webkit-letter-spacing: 0.03rem;\n -moz-letter-spacing: 0.03rem;\n -ms-letter-spacing: 0.03rem;\n letter-spacing: 0.03rem;\n }\n\n .c4 {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .c6 {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n }\n\n .c1 {\n position: relative;\n -webkit-text-decoration: none;\n text-decoration: none;\n display: inline;\n line-height: 1.5rem;\n color: #000000;\n font-weight: normal;\n }\n\n .c1:hover {\n color: #000000;\n }\n\n .c0 {\n width: 100%;\n height: 100%;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n background-color: #FFFFFF;\n border-radius: 1rem;\n box-shadow: 0px 0px 20px rgba(0,0,0,0.15);\n -webkit-transition: all 0.2s;\n transition: all 0.2s;\n }\n\n .c0:hover {\n box-shadow: 0px 0px 20px rgba(0,0,0,0.3);\n -webkit-transform: translateY(-4px);\n -ms-transform: translateY(-4px);\n transform: translateY(-4px);\n }\n\n .c2 {\n padding: 0;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n height: 100%;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-text-decoration: none;\n text-decoration: none;\n color: inherit;\n width: 100%;\n }\n\n .c3 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-align-items: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n position: relative;\n }\n\n .c3 img {\n border-radius: 1rem 1rem 0 0;\n }\n\n .c7 {\n padding: 2rem;\n height: 100%;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n }\n\n .c11 {\n margin: 0;\n }\n\n .c9 {\n display: block;\n margin-bottom: 1rem;\n }\n\n .c5 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n }\n\n @media (min-width:740px) {\n .c2 {\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n }\n\n @media (min-width:1024px) {\n .c2 {\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n }\n }\n\n @media (min-width:740px) {\n .c3 {\n width: 45%;\n }\n\n .c3 img {\n border-radius: 1rem 0 0 1rem;\n }\n }\n\n @media (min-width:1024px) {\n .c3 {\n width: 100%;\n }\n\n .c3 img {\n border-radius: 1rem 1rem 0 0;\n }\n }\n\n @media (min-width:740px) {\n .c7 {\n width: 55%;\n }\n }\n\n @media (min-width:1024px) {\n .c7 {\n width: 100%;\n }\n }\n\n <article\n className=\"c0\"\n >\n <a\n className=\"c1 c2\"\n color=\"red\"\n href=\"/test\"\n target=\"_self\"\n type=\"standard\"\n >\n <div\n className=\"c3\"\n >\n <div\n className=\"c4 c5\"\n height=\"100%\"\n width=\"100%\"\n >\n <img\n alt=\"Image's description\"\n className=\"c6 lazyload\"\n data-lowsrc={null}\n data-sizes=\"auto\"\n data-src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n data-srcset=\"//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w\"\n height=\"100%\"\n src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n srcSet=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n width=\"100%\"\n />\n </div>\n </div>\n <div\n className=\"c7\"\n >\n <span\n className=\"c8 c9\"\n color=\"inherit\"\n size=\"xs\"\n >\n 01 July 2019\n </span>\n <h3\n className=\"c10 c11\"\n color=\"inherit\"\n height=\"2rem\"\n size=\"xl\"\n >\n News article\n </h3>\n </div>\n </a>\n </article>\n ");
22
22
  });
23
- it('renders press realese correctly', () => {
23
+ it("renders press realese correctly", () => {
24
24
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_ArticleTeaser.default, {
25
25
  href: "/test",
26
26
  category: "",
@@ -6,28 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = _interopRequireDefault(require("styled-components"));
10
9
  var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
11
- var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
12
- const Container = _styledComponents.default.div.withConfig({
13
- displayName: "Card__Container",
14
- componentId: "sc-15nltsw-0"
15
- })(["display:flex;position:relative;flex-direction:column;height:100%;border-radius:", ";overflow:hidden;background:", ";"], props => props.squaredCorners ? '0' : '1rem', _ref => {
16
- let {
17
- theme,
18
- backgroundColor
19
- } = _ref;
20
- return theme.color(backgroundColor);
21
- });
22
- const Image = _styledComponents.default.div.withConfig({
23
- displayName: "Card__Image",
24
- componentId: "sc-15nltsw-1"
25
- })(["height:auto;"]);
26
- const Copy = _styledComponents.default.div.withConfig({
27
- displayName: "Card__Copy",
28
- componentId: "sc-15nltsw-2"
29
- })(["padding:", ";display:flex;flex-direction:column;"], (0, _spacing.default)('l'));
30
- const Card = _ref2 => {
10
+ var _Card = require("./Card.style");
11
+ const Card = _ref => {
31
12
  let {
32
13
  backgroundColor,
33
14
  imageLow,
@@ -38,20 +19,29 @@ const Card = _ref2 => {
38
19
  width,
39
20
  children,
40
21
  squaredCorners,
22
+ smallBreakpointRowLayout,
23
+ mediumBreakpointRowLayout,
41
24
  ...rest
42
- } = _ref2;
43
- return /*#__PURE__*/_react.default.createElement(Container, Object.assign({
25
+ } = _ref;
26
+ return /*#__PURE__*/_react.default.createElement(_Card.Container, Object.assign({
44
27
  backgroundColor: backgroundColor,
45
- squaredCorners: squaredCorners
46
- }, rest), imageLow ? /*#__PURE__*/_react.default.createElement(Image, null, /*#__PURE__*/_react.default.createElement(_Picture.default, {
28
+ squaredCorners: squaredCorners,
29
+ smallBreakpointRowLayout: smallBreakpointRowLayout,
30
+ mediumBreakpointRowLayout: mediumBreakpointRowLayout
31
+ }, rest), imageLow ? /*#__PURE__*/_react.default.createElement(_Card.Wrapper, null, /*#__PURE__*/_react.default.createElement(_Picture.default, {
47
32
  alt: imageAltText,
48
33
  imageLow: imageLow,
49
34
  images: images,
50
35
  image: image,
51
36
  objectFit: "cover",
52
37
  width: width,
53
- height: height
54
- })) : null, children ? /*#__PURE__*/_react.default.createElement(Copy, null, children) : null);
38
+ height: height,
39
+ smallBreakpointRowLayout: smallBreakpointRowLayout,
40
+ mediumBreakpointRowLayout: mediumBreakpointRowLayout
41
+ })) : null, children ? /*#__PURE__*/_react.default.createElement(_Card.Copy, {
42
+ smallBreakpointRowLayout: smallBreakpointRowLayout,
43
+ mediumBreakpointRowLayout: mediumBreakpointRowLayout
44
+ }, children) : null);
55
45
  };
56
46
  Card.defaultProps = {
57
47
  backgroundColor: 'white',
@@ -62,6 +52,8 @@ Card.defaultProps = {
62
52
  imageAltText: '',
63
53
  width: '100%',
64
54
  height: '100%',
65
- squaredCorners: false
55
+ squaredCorners: false,
56
+ smallBreakpointRowLayout: null,
57
+ mediumBreakpointRowLayout: null
66
58
  };
67
59
  var _default = exports.default = Card;
@@ -1,5 +1,4 @@
1
1
  # Card
2
-
3
2
  ```js
4
3
  const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
5
4
  import Link from '../../Atoms/Link/Link';
@@ -7,7 +6,7 @@ import Link from '../../Atoms/Link/Link';
7
6
  <Card
8
7
  imageLow={defaultData.image}
9
8
  images={defaultData.images}
10
- backgroundColor="yellow"
9
+ backgroundColor="grey_light"
11
10
  height="auto"
12
11
  >
13
12
  <Text tag="h3" color="purple" size="xl">
@@ -17,9 +16,78 @@ import Link from '../../Atoms/Link/Link';
17
16
  </Card>;
18
17
  ```
19
18
 
19
+ ### Card - row layout on small breakpoint only
20
+ ```js
21
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
22
+ import Link from '../../Atoms/Link/Link';
23
+
24
+ <Card
25
+ imageLow={defaultData.image}
26
+ images={defaultData.images}
27
+ backgroundColor="grey_light"
28
+ height="auto"
29
+ smallBreakpointRowLayout={true}
30
+ mediumBreakpointRowLayout={false}
31
+ >
32
+ <Text tag="h3" color="purple" size="xl">
33
+ Title
34
+ </Text>
35
+ <Text tag="p">
36
+ Your donations make a very real difference to people in the UK and around the world, whether you donate through Red Nose Day, Sport Relief or to Comic Relief at any other time of year. Here are some of the many stories that show how people are changing their lives with your support.
37
+ </Text>
38
+ </Card>;
39
+ ```
40
+
41
+ ### Card - row layout on medium breakpoint only
42
+ ```js
43
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
44
+ import Link from '../../Atoms/Link/Link';
45
+
46
+ <Card
47
+ imageLow={defaultData.image}
48
+ images={defaultData.images}
49
+ backgroundColor="grey_light"
50
+ height="auto"
51
+ smallBreakpointRowLayout={false}
52
+ mediumBreakpointRowLayout={true}
53
+ >
54
+ <Text tag="h3" color="purple" size="xl">
55
+ Title
56
+ </Text>
57
+ <Text tag="p">
58
+ Your donations make a very real difference to people in the UK and around the world, whether you donate through Red Nose Day, Sport Relief or to Comic Relief at any other time of year. Here are some of the many stories that show how people are changing their lives with your support.
59
+ </Text>
60
+ </Card>;
61
+ ```
62
+
63
+ ### Card - row layout on small and medium breakpoints
64
+ ```js
65
+ const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
66
+ import Link from '../../Atoms/Link/Link';
67
+
68
+ <Card
69
+ imageLow={defaultData.image}
70
+ images={defaultData.images}
71
+ backgroundColor="grey_light"
72
+ height="auto"
73
+ smallBreakpointRowLayout={true}
74
+ mediumBreakpointRowLayout={true}
75
+ >
76
+ <Text tag="h3" color="purple" size="xl">
77
+ Title
78
+ </Text>
79
+ <Text tag="p">
80
+ Your donations make a very real difference to people in the UK and around the world, whether you donate through Red Nose Day, Sport Relief or to Comic Relief at any other time of year. Here are some of the many stories that show how people are changing their lives with your support.
81
+ </Text>
82
+ </Card>;
83
+ ```
84
+
20
85
  ### Card no body
21
86
 
22
87
  ```js
23
88
  const defaultData = require('../../../styleguide/data/data').defaultData;
24
- <Card imageLow={defaultData.image} images={defaultData.image} />;
89
+ <Card
90
+ imageLow={defaultData.image}
91
+ images={defaultData.image}
92
+ />;
25
93
  ```
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Wrapper = exports.Copy = exports.Container = void 0;
9
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
10
+ var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
11
+ const Container = exports.Container = _styledComponents.default.div.withConfig({
12
+ displayName: "Cardstyle__Container",
13
+ componentId: "sc-cxn4co-0"
14
+ })(["position:relative;display:flex;@media ", "{flex-direction:", ";}@media ", "{flex-direction:", ";}@media ", "{flex-direction:column;}height:100%;border-radius:", ";overflow:hidden;background:", ";"], _ref => {
15
+ let {
16
+ theme
17
+ } = _ref;
18
+ return theme.allBreakpoints('S');
19
+ }, props => props.smallBreakpointRowLayout === true ? 'row' : 'column', _ref2 => {
20
+ let {
21
+ theme
22
+ } = _ref2;
23
+ return theme.allBreakpoints('M');
24
+ }, props => props.mediumBreakpointRowLayout === true ? 'row' : 'column', _ref3 => {
25
+ let {
26
+ theme
27
+ } = _ref3;
28
+ return theme.allBreakpoints('L');
29
+ }, props => props.squaredCorners ? '0' : '1rem', _ref4 => {
30
+ let {
31
+ theme,
32
+ backgroundColor
33
+ } = _ref4;
34
+ return theme.color(backgroundColor);
35
+ });
36
+ const Wrapper = exports.Wrapper = _styledComponents.default.div.withConfig({
37
+ displayName: "Cardstyle__Wrapper",
38
+ componentId: "sc-cxn4co-1"
39
+ })(["height:auto;"]);
40
+ const Copy = exports.Copy = _styledComponents.default.div.withConfig({
41
+ displayName: "Cardstyle__Copy",
42
+ componentId: "sc-cxn4co-2"
43
+ })(["display:flex;flex-direction:column;padding:", ";", " ", " ", ""], (0, _spacing.default)('l'), _ref5 => {
44
+ let {
45
+ smallBreakpointRowLayout
46
+ } = _ref5;
47
+ return smallBreakpointRowLayout === true && (0, _styledComponents.css)(["@media ", "{padding:", ";h1,h2,h3,h4,h5{margin:", ";}}"], _ref6 => {
48
+ let {
49
+ theme
50
+ } = _ref6;
51
+ return theme.allBreakpoints('S');
52
+ }, props => props.smallBreakpointRowLayout === true && "".concat((0, _spacing.default)('sm')), props => props.smallBreakpointRowLayout === true && "".concat((0, _spacing.default)('sm'), " 0 ").concat((0, _spacing.default)('sm')));
53
+ }, _ref7 => {
54
+ let {
55
+ mediumBreakpointRowLayout
56
+ } = _ref7;
57
+ return mediumBreakpointRowLayout === true && (0, _styledComponents.css)(["@media ", "{padding:", ";h1,h2,h3,h4,h5{margin:", ";}}"], _ref8 => {
58
+ let {
59
+ theme
60
+ } = _ref8;
61
+ return theme.allBreakpoints('M');
62
+ }, props => props.mediumBreakpointRowLayout === true && "".concat((0, _spacing.default)('sm')), props => props.mediumBreakpointRowLayout === true && "".concat((0, _spacing.default)('sm'), " 0 ").concat((0, _spacing.default)('sm')));
63
+ }, _ref9 => {
64
+ let {
65
+ smallBreakpointRowLayout,
66
+ mediumBreakpointRowLayout
67
+ } = _ref9;
68
+ return (smallBreakpointRowLayout === true || mediumBreakpointRowLayout === true) && (0, _styledComponents.css)(["@media ", "{padding:", ";h1{margin:0 0 1rem 0;}h2{margin-bottom:2rem;}h3,h4,h5{margin-bottom:1rem;}}"], _ref10 => {
69
+ let {
70
+ theme
71
+ } = _ref10;
72
+ return theme.allBreakpoints('L');
73
+ }, (0, _spacing.default)('l'));
74
+ });
@@ -14,6 +14,16 @@ it('renders correctly', () => {
14
14
  }, /*#__PURE__*/_react.default.createElement("h2", null, "Title"), /*#__PURE__*/_react.default.createElement("p", null, "Description"))).toJSON();
15
15
  expect(tree).toMatchSnapshot();
16
16
  });
17
+ it('renders correctly', () => {
18
+ const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Card.default, {
19
+ image: _data.defaultData.image,
20
+ images: _data.defaultData.image,
21
+ backgroundColor: "yellow",
22
+ smallBreakpointLayout: "Row",
23
+ mediumBreakpointLayout: "Row"
24
+ }, /*#__PURE__*/_react.default.createElement("h2", null, "Title"), /*#__PURE__*/_react.default.createElement("p", null, "Text body copy description. Loads more text test. Loads more text test."))).toJSON();
25
+ expect(tree).toMatchSnapshot();
26
+ });
17
27
  it('renders correctly with no body', () => {
18
28
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Card.default, {
19
29
  imageLow: _data.defaultData.image,
@@ -2,14 +2,75 @@
2
2
 
3
3
  exports[`renders correctly 1`] = `
4
4
  .c0 {
5
+ position: relative;
6
+ display: -webkit-box;
7
+ display: -webkit-flex;
8
+ display: -ms-flexbox;
9
+ display: flex;
10
+ height: 100%;
11
+ border-radius: 1rem;
12
+ overflow: hidden;
13
+ background: #FFE400;
14
+ }
15
+
16
+ .c1 {
5
17
  display: -webkit-box;
6
18
  display: -webkit-flex;
7
19
  display: -ms-flexbox;
8
20
  display: flex;
9
- position: relative;
10
21
  -webkit-flex-direction: column;
11
22
  -ms-flex-direction: column;
12
23
  flex-direction: column;
24
+ padding: 2rem;
25
+ }
26
+
27
+ @media (min-width:0px) {
28
+ .c0 {
29
+ -webkit-flex-direction: column;
30
+ -ms-flex-direction: column;
31
+ flex-direction: column;
32
+ }
33
+ }
34
+
35
+ @media (min-width:740px) {
36
+ .c0 {
37
+ -webkit-flex-direction: column;
38
+ -ms-flex-direction: column;
39
+ flex-direction: column;
40
+ }
41
+ }
42
+
43
+ @media (min-width:1024px) {
44
+ .c0 {
45
+ -webkit-flex-direction: column;
46
+ -ms-flex-direction: column;
47
+ flex-direction: column;
48
+ }
49
+ }
50
+
51
+ <div
52
+ className="c0"
53
+ >
54
+ <div
55
+ className="c1"
56
+ >
57
+ <h2>
58
+ Title
59
+ </h2>
60
+ <p>
61
+ Description
62
+ </p>
63
+ </div>
64
+ </div>
65
+ `;
66
+
67
+ exports[`renders correctly 2`] = `
68
+ .c0 {
69
+ position: relative;
70
+ display: -webkit-box;
71
+ display: -webkit-flex;
72
+ display: -ms-flexbox;
73
+ display: flex;
13
74
  height: 100%;
14
75
  border-radius: 1rem;
15
76
  overflow: hidden;
@@ -17,7 +78,6 @@ exports[`renders correctly 1`] = `
17
78
  }
18
79
 
19
80
  .c1 {
20
- padding: 2rem;
21
81
  display: -webkit-box;
22
82
  display: -webkit-flex;
23
83
  display: -ms-flexbox;
@@ -25,6 +85,31 @@ exports[`renders correctly 1`] = `
25
85
  -webkit-flex-direction: column;
26
86
  -ms-flex-direction: column;
27
87
  flex-direction: column;
88
+ padding: 2rem;
89
+ }
90
+
91
+ @media (min-width:0px) {
92
+ .c0 {
93
+ -webkit-flex-direction: column;
94
+ -ms-flex-direction: column;
95
+ flex-direction: column;
96
+ }
97
+ }
98
+
99
+ @media (min-width:740px) {
100
+ .c0 {
101
+ -webkit-flex-direction: column;
102
+ -ms-flex-direction: column;
103
+ flex-direction: column;
104
+ }
105
+ }
106
+
107
+ @media (min-width:1024px) {
108
+ .c0 {
109
+ -webkit-flex-direction: column;
110
+ -ms-flex-direction: column;
111
+ flex-direction: column;
112
+ }
28
113
  }
29
114
 
30
115
  <div
@@ -37,7 +122,7 @@ exports[`renders correctly 1`] = `
37
122
  Title
38
123
  </h2>
39
124
  <p>
40
- Description
125
+ Text body copy description. Loads more text test. Loads more text test.
41
126
  </p>
42
127
  </div>
43
128
  </div>
@@ -59,14 +144,11 @@ exports[`renders correctly with no body 1`] = `
59
144
  }
60
145
 
61
146
  .c0 {
147
+ position: relative;
62
148
  display: -webkit-box;
63
149
  display: -webkit-flex;
64
150
  display: -ms-flexbox;
65
151
  display: flex;
66
- position: relative;
67
- -webkit-flex-direction: column;
68
- -ms-flex-direction: column;
69
- flex-direction: column;
70
152
  height: 100%;
71
153
  border-radius: 1rem;
72
154
  overflow: hidden;
@@ -77,6 +159,30 @@ exports[`renders correctly with no body 1`] = `
77
159
  height: auto;
78
160
  }
79
161
 
162
+ @media (min-width:0px) {
163
+ .c0 {
164
+ -webkit-flex-direction: column;
165
+ -ms-flex-direction: column;
166
+ flex-direction: column;
167
+ }
168
+ }
169
+
170
+ @media (min-width:740px) {
171
+ .c0 {
172
+ -webkit-flex-direction: column;
173
+ -ms-flex-direction: column;
174
+ flex-direction: column;
175
+ }
176
+ }
177
+
178
+ @media (min-width:1024px) {
179
+ .c0 {
180
+ -webkit-flex-direction: column;
181
+ -ms-flex-direction: column;
182
+ flex-direction: column;
183
+ }
184
+ }
185
+
80
186
  <div
81
187
  className="c0"
82
188
  >
@@ -7,7 +7,7 @@ var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWith
7
7
  var _PartnerLink = _interopRequireDefault(require("./PartnerLink"));
8
8
  var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
9
9
  var _data = require("../../../styleguide/data/data");
10
- it('renders correctly', () => {
10
+ it("renders correctly", () => {
11
11
  const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_PartnerLink.default, {
12
12
  link: "https://www.comicrelief.com"
13
13
  }, /*#__PURE__*/_react.default.createElement(_Picture.default, {
package/dist/index.js CHANGED
@@ -334,6 +334,12 @@ Object.defineProperty(exports, "allBreakpoints", {
334
334
  return _allBreakpoints.default;
335
335
  }
336
336
  });
337
+ Object.defineProperty(exports, "allContainers", {
338
+ enumerable: true,
339
+ get: function () {
340
+ return _allContainers.default;
341
+ }
342
+ });
337
343
  Object.defineProperty(exports, "allowListed", {
338
344
  enumerable: true,
339
345
  get: function () {
@@ -422,6 +428,7 @@ var _spacing = _interopRequireDefault(require("./theme/shared/spacing"));
422
428
  var _breakpoint = _interopRequireDefault(require("./theme/shared/breakpoint"));
423
429
  var _allBreakpoints = _interopRequireDefault(require("./theme/shared/allBreakpoints"));
424
430
  var _size = require("./theme/shared/size");
431
+ var _allContainers = _interopRequireDefault(require("./theme/shared/allContainers"));
425
432
  var _Text = _interopRequireDefault(require("./components/Atoms/Text/Text"));
426
433
  var _Logo = _interopRequireDefault(require("./components/Atoms/Logo/Logo"));
427
434
  var _Picture = _interopRequireDefault(require("./components/Atoms/Picture/Picture"));
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- const container = {
7
+ const allContainers = {
8
8
  small: '880px',
9
9
  medium: '1200px',
10
10
  large: '1440px'
11
11
  };
12
- var _default = exports.default = container;
12
+ var _default = exports.default = allContainers;
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.39.0",
4
+ "version": "7.41.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {