@comicrelief/component-library 7.33.0 → 7.34.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.
@@ -1,105 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
8
  var _react = _interopRequireDefault(require("react"));
10
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
9
  var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
12
10
  var _Link = _interopRequireDefault(require("../../Atoms/Link/Link"));
13
- var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
14
- var _zIndex = _interopRequireDefault(require("../../../theme/shared/zIndex"));
15
- const Container = _styledComponents.default.div.withConfig({
16
- displayName: "CardDs__Container",
17
- componentId: "sc-mayd3d-0"
18
- })(["display:flex;position:relative;flex-direction:column;height:100%;width:100%;background:", ";@media ", "{flex-direction:row;}@media ", "{flex-direction:column;}"], _ref => {
19
- let {
20
- theme,
21
- backgroundColor
22
- } = _ref;
23
- return theme.color(backgroundColor);
24
- }, _ref2 => {
25
- let {
26
- theme
27
- } = _ref2;
28
- return theme.breakpoint('small');
29
- }, _ref3 => {
30
- let {
31
- theme
32
- } = _ref3;
33
- return theme.breakpoint('large');
34
- });
35
- const Image = _styledComponents.default.div.withConfig({
36
- displayName: "CardDs__Image",
37
- componentId: "sc-mayd3d-1"
38
- })(["height:auto;margin:0 -", " 0 ", ";img{border-radius:", ";box-shadow:0 0 ", " rgba(0,0,0,0.15);}"], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('md'), (0, _spacing.default)('md'));
39
- const MediaLink = _styledComponents.default.a.withConfig({
40
- displayName: "CardDs__MediaLink",
41
- componentId: "sc-mayd3d-2"
42
- })(["width:100%;@media ", "{width:calc(50% + 6rem);}@media ", "{width:100%;}"], _ref4 => {
43
- let {
44
- theme
45
- } = _ref4;
46
- return theme.breakpoint('small');
47
- }, _ref5 => {
48
- let {
49
- theme
50
- } = _ref5;
51
- return theme.breakpoint('large');
52
- });
53
- const Copy = _styledComponents.default.div.withConfig({
54
- displayName: "CardDs__Copy",
55
- componentId: "sc-mayd3d-3"
56
- })(["padding:", ";", ";display:flex;flex-direction:column;border-radius:", ";box-shadow:0 0 ", " rgba(0,0,0,0.15);background:", ";width:100%;@media ", "{height:100%;}", ";", ";"], (0, _spacing.default)('l'), _ref6 => {
57
- let {
58
- hasLink
59
- } = _ref6;
60
- return hasLink && "padding-bottom: ".concat((0, _spacing.default)('xl'));
61
- }, (0, _spacing.default)('md'), (0, _spacing.default)('md'), _ref7 => {
62
- let {
63
- theme,
64
- backgroundColor
65
- } = _ref7;
66
- return theme.color(backgroundColor);
67
- }, _ref8 => {
68
- let {
69
- theme
70
- } = _ref8;
71
- return theme.breakpoint('large');
72
- }, (0, _zIndex.default)('low'), _ref9 => {
73
- let {
74
- hasImage
75
- } = _ref9;
76
- return hasImage && (0, _styledComponents.css)(["margin-top:calc(-2 * ", ");min-height:calc(5 * ", ");@media ", "{margin:", " 0 -", " -", ";width:calc(50% + 6rem);}@media ", "{margin:calc(-2 * ", ") 0 -", " 0;width:100%;}"], (0, _spacing.default)('m'), (0, _spacing.default)('l'), _ref10 => {
77
- let {
78
- theme
79
- } = _ref10;
80
- return theme.breakpoint('small');
81
- }, (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('m'), _ref11 => {
82
- let {
83
- theme
84
- } = _ref11;
85
- return theme.breakpoint('large');
86
- }, (0, _spacing.default)('m'), (0, _spacing.default)('m'));
87
- });
88
- const CTA = _styledComponents.default.div.withConfig({
89
- displayName: "CardDs__CTA",
90
- componentId: "sc-mayd3d-4"
91
- })(["position:absolute;right:", ";bottom:-", ";", ";@media ", "{bottom:calc(-1 * (", " + ", "));", ";}"], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _zIndex.default)('medium'), _ref12 => {
92
- let {
93
- theme
94
- } = _ref12;
95
- return theme.breakpoint('small');
96
- }, (0, _spacing.default)('l'), (0, _spacing.default)('md'), _ref13 => {
97
- let {
98
- hasImage
99
- } = _ref13;
100
- return !hasImage && "bottom: -".concat((0, _spacing.default)('m'), ";");
101
- });
102
- const CardDs = _ref14 => {
11
+ var _CardDs = require("./CardDs.style");
12
+ const CardDs = _ref => {
103
13
  let {
104
14
  icon,
105
15
  backgroundColor,
@@ -114,8 +24,8 @@ const CardDs = _ref14 => {
114
24
  linkLabel,
115
25
  target,
116
26
  ...rest
117
- } = _ref14;
118
- const Media = /*#__PURE__*/_react.default.createElement(Image, {
27
+ } = _ref;
28
+ const Media = /*#__PURE__*/_react.default.createElement(_CardDs.Image, {
119
29
  hasLink: link
120
30
  }, /*#__PURE__*/_react.default.createElement(_Picture.default, {
121
31
  alt: imageAltText,
@@ -128,7 +38,7 @@ const CardDs = _ref14 => {
128
38
  }));
129
39
  const hasMedia = () => {
130
40
  if (imageLow && link) {
131
- return /*#__PURE__*/_react.default.createElement(MediaLink, Object.assign({
41
+ return /*#__PURE__*/_react.default.createElement(_CardDs.MediaLink, Object.assign({
132
42
  "aria-hidden": "true",
133
43
  tabIndex: "-1",
134
44
  href: link,
@@ -142,11 +52,11 @@ const CardDs = _ref14 => {
142
52
  return null;
143
53
  };
144
54
  const external = target === 'blank' ? 'noopener' : null;
145
- return /*#__PURE__*/_react.default.createElement(Container, rest, hasMedia(), /*#__PURE__*/_react.default.createElement(Copy, {
55
+ return /*#__PURE__*/_react.default.createElement(_CardDs.Container, rest, hasMedia(), /*#__PURE__*/_react.default.createElement(_CardDs.Copy, {
146
56
  hasImage: imageLow,
147
57
  hasLink: link,
148
58
  backgroundColor: backgroundColor
149
- }, children), link && /*#__PURE__*/_react.default.createElement(CTA, {
59
+ }, children), link && /*#__PURE__*/_react.default.createElement(_CardDs.CTA, {
150
60
  hasImage: imageLow
151
61
  }, /*#__PURE__*/_react.default.createElement(_Link.default, {
152
62
  rel: external,
@@ -0,0 +1,103 @@
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.MediaLink = exports.Image = exports.Copy = exports.Container = exports.CTA = void 0;
9
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
10
+ var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
11
+ var _zIndex = _interopRequireDefault(require("../../../theme/shared/zIndex"));
12
+ const Container = exports.Container = _styledComponents.default.div.withConfig({
13
+ displayName: "CardDsstyle__Container",
14
+ componentId: "sc-1m4yp5m-0"
15
+ })(["display:flex;position:relative;flex-direction:column;height:100%;width:100%;background:", ";@media ", "{flex-direction:row;}@media ", "{flex-direction:column;}"], _ref => {
16
+ let {
17
+ theme,
18
+ backgroundColor
19
+ } = _ref;
20
+ return theme.color(backgroundColor);
21
+ }, _ref2 => {
22
+ let {
23
+ theme
24
+ } = _ref2;
25
+ return theme.breakpoint('small');
26
+ }, _ref3 => {
27
+ let {
28
+ theme
29
+ } = _ref3;
30
+ return theme.breakpoint('large');
31
+ });
32
+ const Image = exports.Image = _styledComponents.default.div.withConfig({
33
+ displayName: "CardDsstyle__Image",
34
+ componentId: "sc-1m4yp5m-1"
35
+ })(["height:auto;margin:0 0 0 ", ";@media ", "{margin:0 -", " 0 ", ";}img{border-radius:", ";box-shadow:0 0 ", " rgba(0,0,0,0.15);}"], (0, _spacing.default)('m'), _ref4 => {
36
+ let {
37
+ theme
38
+ } = _ref4;
39
+ return theme.breakpoint('small');
40
+ }, (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('md'), (0, _spacing.default)('md'));
41
+ const MediaLink = exports.MediaLink = _styledComponents.default.a.withConfig({
42
+ displayName: "CardDsstyle__MediaLink",
43
+ componentId: "sc-1m4yp5m-2"
44
+ })(["width:100%;@media ", "{width:calc(50% + 6rem);}@media ", "{width:100%;}"], _ref5 => {
45
+ let {
46
+ theme
47
+ } = _ref5;
48
+ return theme.breakpoint('small');
49
+ }, _ref6 => {
50
+ let {
51
+ theme
52
+ } = _ref6;
53
+ return theme.breakpoint('large');
54
+ });
55
+ const Copy = exports.Copy = _styledComponents.default.div.withConfig({
56
+ displayName: "CardDsstyle__Copy",
57
+ componentId: "sc-1m4yp5m-3"
58
+ })(["padding:", ";", ";display:flex;flex-direction:column;border-radius:", ";box-shadow:0 0 ", " rgba(0,0,0,0.15);background:", ";margin:0 ", " 0 0;@media ", "{height:100%;}", ";", ";"], (0, _spacing.default)('l'), _ref7 => {
59
+ let {
60
+ hasLink
61
+ } = _ref7;
62
+ return hasLink && "padding-bottom: ".concat((0, _spacing.default)('xl'));
63
+ }, (0, _spacing.default)('md'), (0, _spacing.default)('md'), _ref8 => {
64
+ let {
65
+ theme,
66
+ backgroundColor
67
+ } = _ref8;
68
+ return theme.color(backgroundColor);
69
+ }, (0, _spacing.default)('m'), _ref9 => {
70
+ let {
71
+ theme
72
+ } = _ref9;
73
+ return theme.breakpoint('large');
74
+ }, (0, _zIndex.default)('low'), _ref10 => {
75
+ let {
76
+ hasImage
77
+ } = _ref10;
78
+ return hasImage && (0, _styledComponents.css)(["margin-top:calc(-2 * ", ");min-height:calc(5 * ", ");@media ", "{margin:", " 0 -", " -", ";width:calc(50% + 6rem);}@media ", "{margin:calc(-2 * ", ") 0 -", " 0;width:100%;}"], (0, _spacing.default)('m'), (0, _spacing.default)('l'), _ref11 => {
79
+ let {
80
+ theme
81
+ } = _ref11;
82
+ return theme.breakpoint('small');
83
+ }, (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('m'), _ref12 => {
84
+ let {
85
+ theme
86
+ } = _ref12;
87
+ return theme.breakpoint('large');
88
+ }, (0, _spacing.default)('m'), (0, _spacing.default)('m'));
89
+ });
90
+ const CTA = exports.CTA = _styledComponents.default.div.withConfig({
91
+ displayName: "CardDsstyle__CTA",
92
+ componentId: "sc-1m4yp5m-4"
93
+ })(["position:absolute;right:", ";bottom:-", ";", ";@media ", "{bottom:calc(-1 * (", " + ", "));", ";}"], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _zIndex.default)('medium'), _ref13 => {
94
+ let {
95
+ theme
96
+ } = _ref13;
97
+ return theme.breakpoint('small');
98
+ }, (0, _spacing.default)('l'), (0, _spacing.default)('md'), _ref14 => {
99
+ let {
100
+ hasImage
101
+ } = _ref14;
102
+ return !hasImage && "bottom: -".concat((0, _spacing.default)('m'), ";");
103
+ });
@@ -77,7 +77,7 @@ exports[`renders correctly 1`] = `
77
77
 
78
78
  .c2 {
79
79
  height: auto;
80
- margin: 0 -1.5rem 0 1.5rem;
80
+ margin: 0 0 0 1.5rem;
81
81
  }
82
82
 
83
83
  .c2 img {
@@ -102,7 +102,7 @@ exports[`renders correctly 1`] = `
102
102
  border-radius: 1rem;
103
103
  box-shadow: 0 0 1rem rgba(0,0,0,0.15);
104
104
  background: #FFFFFF;
105
- width: 100%;
105
+ margin: 0 1.5rem 0 0;
106
106
  z-index: 1;
107
107
  margin-top: calc(-2 * 1.5rem);
108
108
  min-height: calc(5 * 2rem);
@@ -145,6 +145,12 @@ exports[`renders correctly 1`] = `
145
145
  }
146
146
  }
147
147
 
148
+ @media (min-width:740px) {
149
+ .c2 {
150
+ margin: 0 -1.5rem 0 1.5rem;
151
+ }
152
+ }
153
+
148
154
  @media (min-width:740px) {
149
155
  .c1 {
150
156
  width: calc(50% + 6rem);
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.33.0",
4
+ "version": "7.34.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -1,86 +1,10 @@
1
1
  import React from 'react';
2
- import styled, { css } from 'styled-components';
3
2
  import PropTypes from 'prop-types';
4
3
  import Picture from '../../Atoms/Picture/Picture';
5
4
  import Link from '../../Atoms/Link/Link';
6
- import spacing from '../../../theme/shared/spacing';
7
- import zIndex from '../../../theme/shared/zIndex';
8
-
9
- const Container = styled.div`
10
- display: flex;
11
- position: relative;
12
- flex-direction: column;
13
- height: 100%;
14
- width: 100%;
15
- background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
16
- @media ${({ theme }) => theme.breakpoint('small')} {
17
- flex-direction: row;
18
- }
19
-
20
- @media ${({ theme }) => theme.breakpoint('large')} {
21
- flex-direction: column;
22
- }
23
- `;
24
-
25
- const Image = styled.div`
26
- height: auto;
27
- margin: 0 -${spacing('m')} 0 ${spacing('m')};
28
-
29
- img {
30
- border-radius: ${spacing('md')};
31
- box-shadow: 0 0 ${spacing('md')} rgba(0, 0, 0, 0.15);
32
- }
33
- `;
34
-
35
- const MediaLink = styled.a`
36
- width: 100%;
37
- @media ${({ theme }) => theme.breakpoint('small')} {
38
- width: calc(50% + 6rem);
39
- }
40
- @media ${({ theme }) => theme.breakpoint('large')} {
41
- width: 100%;
42
- }
43
- `;
44
-
45
- const Copy = styled.div`
46
- padding: ${spacing('l')};
47
- ${({ hasLink }) => hasLink && `padding-bottom: ${spacing('xl')}`};
48
- display: flex;
49
- flex-direction: column;
50
- border-radius: ${spacing('md')};
51
- box-shadow: 0 0 ${spacing('md')} rgba(0, 0, 0, 0.15);
52
- background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
53
- width: 100%;
54
- @media ${({ theme }) => theme.breakpoint('large')} {
55
- height: 100%;
56
- }
57
- ${zIndex('low')};
58
- ${({ hasImage }) => hasImage
59
- && css`
60
- margin-top: calc(-2 * ${spacing('m')});
61
- min-height: calc(5 * ${spacing('l')});
62
- @media ${({ theme }) => theme.breakpoint('small')} {
63
- margin: ${spacing('m')} 0 -${spacing('m')} -${spacing('m')};
64
- width: calc(50% + 6rem);
65
- }
66
-
67
- @media ${({ theme }) => theme.breakpoint('large')} {
68
- margin: calc(-2 * ${spacing('m')}) 0 -${spacing('m')} 0;
69
- width: 100%;
70
- }
71
- `};
72
- `;
73
-
74
- const CTA = styled.div`
75
- position: absolute;
76
- right: ${spacing('m')};
77
- bottom: -${spacing('m')};
78
- ${zIndex('medium')};
79
- @media ${({ theme }) => theme.breakpoint('small')} {
80
- bottom: calc(-1 * (${spacing('l')} + ${spacing('md')}));
81
- ${({ hasImage }) => !hasImage && `bottom: -${spacing('m')};`};
82
- }
83
- `;
5
+ import {
6
+ Container, Image, MediaLink, Copy, CTA
7
+ } from './CardDs.style';
84
8
 
85
9
  const CardDs = ({
86
10
  icon,
@@ -0,0 +1,87 @@
1
+ import styled, { css } from 'styled-components';
2
+ import spacing from '../../../theme/shared/spacing';
3
+ import zIndex from '../../../theme/shared/zIndex';
4
+
5
+ const Container = styled.div`
6
+ display: flex;
7
+ position: relative;
8
+ flex-direction: column;
9
+ height: 100%;
10
+ width: 100%;
11
+ background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
12
+ @media ${({ theme }) => theme.breakpoint('small')} {
13
+ flex-direction: row;
14
+ }
15
+
16
+ @media ${({ theme }) => theme.breakpoint('large')} {
17
+ flex-direction: column;
18
+ }
19
+ `;
20
+
21
+ const Image = styled.div`
22
+ height: auto;
23
+ margin: 0 0 0 ${spacing('m')};
24
+ @media ${({ theme }) => theme.breakpoint('small')} {
25
+ margin: 0 -${spacing('m')} 0 ${spacing('m')};
26
+ }
27
+
28
+ img {
29
+ border-radius: ${spacing('md')};
30
+ box-shadow: 0 0 ${spacing('md')} rgba(0, 0, 0, 0.15);
31
+ }
32
+ `;
33
+
34
+ const MediaLink = styled.a`
35
+ width: 100%;
36
+ @media ${({ theme }) => theme.breakpoint('small')} {
37
+ width: calc(50% + 6rem);
38
+ }
39
+ @media ${({ theme }) => theme.breakpoint('large')} {
40
+ width: 100%;
41
+ }
42
+ `;
43
+
44
+ const Copy = styled.div`
45
+ padding: ${spacing('l')};
46
+ ${({ hasLink }) => hasLink && `padding-bottom: ${spacing('xl')}`};
47
+ display: flex;
48
+ flex-direction: column;
49
+ border-radius: ${spacing('md')};
50
+ box-shadow: 0 0 ${spacing('md')} rgba(0, 0, 0, 0.15);
51
+ background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
52
+ // width: 100%;
53
+ margin: 0 ${spacing('m')} 0 0;
54
+ @media ${({ theme }) => theme.breakpoint('large')} {
55
+ height: 100%;
56
+ }
57
+ ${zIndex('low')};
58
+ ${({ hasImage }) => hasImage
59
+ && css`
60
+ margin-top: calc(-2 * ${spacing('m')});
61
+ min-height: calc(5 * ${spacing('l')});
62
+ @media ${({ theme }) => theme.breakpoint('small')} {
63
+ margin: ${spacing('m')} 0 -${spacing('m')} -${spacing('m')};
64
+ width: calc(50% + 6rem);
65
+ }
66
+
67
+ @media ${({ theme }) => theme.breakpoint('large')} {
68
+ margin: calc(-2 * ${spacing('m')}) 0 -${spacing('m')} 0;
69
+ width: 100%;
70
+ }
71
+ `};
72
+ `;
73
+
74
+ const CTA = styled.div`
75
+ position: absolute;
76
+ right: ${spacing('m')};
77
+ bottom: -${spacing('m')};
78
+ ${zIndex('medium')};
79
+ @media ${({ theme }) => theme.breakpoint('small')} {
80
+ bottom: calc(-1 * (${spacing('l')} + ${spacing('md')}));
81
+ ${({ hasImage }) => !hasImage && `bottom: -${spacing('m')};`};
82
+ }
83
+ `;
84
+
85
+ export {
86
+ Container, Image, MediaLink, Copy, CTA
87
+ };
@@ -77,7 +77,7 @@ exports[`renders correctly 1`] = `
77
77
 
78
78
  .c2 {
79
79
  height: auto;
80
- margin: 0 -1.5rem 0 1.5rem;
80
+ margin: 0 0 0 1.5rem;
81
81
  }
82
82
 
83
83
  .c2 img {
@@ -102,7 +102,7 @@ exports[`renders correctly 1`] = `
102
102
  border-radius: 1rem;
103
103
  box-shadow: 0 0 1rem rgba(0,0,0,0.15);
104
104
  background: #FFFFFF;
105
- width: 100%;
105
+ margin: 0 1.5rem 0 0;
106
106
  z-index: 1;
107
107
  margin-top: calc(-2 * 1.5rem);
108
108
  min-height: calc(5 * 2rem);
@@ -145,6 +145,12 @@ exports[`renders correctly 1`] = `
145
145
  }
146
146
  }
147
147
 
148
+ @media (min-width:740px) {
149
+ .c2 {
150
+ margin: 0 -1.5rem 0 1.5rem;
151
+ }
152
+ }
153
+
148
154
  @media (min-width:740px) {
149
155
  .c1 {
150
156
  width: calc(50% + 6rem);