@comicrelief/component-library 7.32.0 → 7.33.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.
@@ -29,7 +29,8 @@ const SingleMessage = _ref => {
29
29
  fullImage,
30
30
  vhFull,
31
31
  videoID,
32
- landscapeVideo
32
+ landscapeVideo,
33
+ paddingOption
33
34
  } = _ref;
34
35
  const hasImage = imageSet || false;
35
36
  const doubleImage = (imageSet || image) && (imageSet2 || image2);
@@ -166,7 +167,8 @@ const SingleMessage = _ref => {
166
167
  hasImage: hasImage,
167
168
  copyFirst: copyFirst,
168
169
  hasVideo: hasVideo,
169
- vhFull: vhFull
170
+ vhFull: vhFull,
171
+ paddingOption: paddingOption
170
172
  }, children) : null))
171
173
  );
172
174
  };
@@ -184,6 +186,7 @@ SingleMessage.defaultProps = {
184
186
  children: null,
185
187
  vhFull: false,
186
188
  videoID: null,
187
- landscapeVideo: false
189
+ landscapeVideo: false,
190
+ paddingOption: null
188
191
  };
189
192
  var _default = exports.default = SingleMessage;
@@ -84,6 +84,59 @@ import Text from '../../Atoms/Text/Text';
84
84
  </SingleMessage>;
85
85
  ```
86
86
 
87
+ Single Message with no Image - padding unmodified
88
+
89
+ ```js
90
+ import Text from '../../Atoms/Text/Text';
91
+
92
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="both_on">
93
+ <Text tag="p" color="white" size="xxl">
94
+ “The creativity that goes into helping people have a better life is
95
+ extraordinary.”
96
+ </Text>
97
+ </SingleMessage>;
98
+ ```
99
+
100
+ Single Message with no Image - no bottom padding
101
+
102
+ ```js
103
+ import Text from '../../Atoms/Text/Text';
104
+
105
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="lower_off">
106
+ <Text tag="p" color="white" size="xxl">
107
+ “The creativity that goes into helping people have a better life is
108
+ extraordinary.”
109
+ </Text>
110
+ </SingleMessage>;
111
+ ```
112
+
113
+
114
+ Single Message with no Image - no top padding
115
+
116
+ ```js
117
+ import Text from '../../Atoms/Text/Text';
118
+
119
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="upper_off">
120
+ <Text tag="p" color="white" size="xxl">
121
+ “The creativity that goes into helping people have a better life is
122
+ extraordinary.”
123
+ </Text>
124
+ </SingleMessage>;
125
+ ```
126
+
127
+ Single Message with no Image - no top and bottom padding
128
+
129
+ ```js
130
+ import Text from '../../Atoms/Text/Text';
131
+
132
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="both_off">
133
+ <Text tag="p" color="white" size="xxl">
134
+ “The creativity that goes into helping people have a better life is
135
+ extraordinary.”
136
+ </Text>
137
+ </SingleMessage>;
138
+ ```
139
+
87
140
  Single Message vertical height 100%
88
141
 
89
142
  ```js
@@ -13,6 +13,7 @@ var _zIndex = _interopRequireDefault(require("../../../theme/shared/zIndex"));
13
13
  var _videoPlayIcon = _interopRequireDefault(require("./assets/video--play-icon.svg"));
14
14
  var _videoPlayIcon__hover = _interopRequireDefault(require("./assets/video--play-icon__hover.svg"));
15
15
  var _loader = _interopRequireDefault(require("./assets/loader.svg"));
16
+ var _utils = _interopRequireDefault(require("../../../utils/_utils"));
16
17
  const Container = exports.Container = _styledComponents.default.div.withConfig({
17
18
  displayName: "SingleMessagestyle__Container",
18
19
  componentId: "sc-86zg20-0"
@@ -48,7 +49,7 @@ const Container = exports.Container = _styledComponents.default.div.withConfig({
48
49
  const Copy = exports.Copy = _styledComponents.default.div.withConfig({
49
50
  displayName: "SingleMessagestyle__Copy",
50
51
  componentId: "sc-86zg20-1"
51
- })(["width:100%;", ";", ";padding:", ";", "{", ";", ";flex-direction:column;justify-content:center;padding:", ";}", ";", ";"], (0, _zIndex.default)('low'), _ref6 => {
52
+ })(["width:100%;", ";", ";padding:", ";", "{", ";", ";flex-direction:column;justify-content:center;padding:", ";}", ";", ";", "{", ";}"], (0, _zIndex.default)('low'), _ref6 => {
52
53
  let {
53
54
  hasVideo,
54
55
  fullImage
@@ -76,113 +77,118 @@ const Copy = exports.Copy = _styledComponents.default.div.withConfig({
76
77
  theme
77
78
  } = _ref10;
78
79
  return theme.breakpoint('small');
79
- }, _size.container.small, (0, _spacing.default)('xl'), (0, _spacing.default)('md')));
80
+ }, _size.container.small, (0, _spacing.default)('xl'), (0, _spacing.default)('md')), (0, _size.media)('medium'), _ref11 => {
81
+ let {
82
+ paddingOption
83
+ } = _ref11;
84
+ return (0, _utils.default)(paddingOption);
85
+ });
80
86
  const Media = exports.Media = _styledComponents.default.div.withConfig({
81
87
  displayName: "SingleMessagestyle__Media",
82
88
  componentId: "sc-86zg20-2"
83
- })(["width:100%;", ";@media ", "{height:auto;width:", ";", ";", ";}position:relative;", ";", ";", "{padding-bottom:", ";}"], _ref11 => {
89
+ })(["width:100%;", ";@media ", "{height:auto;width:", ";", ";", ";}position:relative;", ";", ";", "{padding-bottom:", ";}"], _ref12 => {
84
90
  let {
85
91
  fullImage
86
- } = _ref11;
92
+ } = _ref12;
87
93
  return fullImage ? 'height: 200px;' : 'height: 280px;';
88
- }, _ref12 => {
94
+ }, _ref13 => {
89
95
  let {
90
96
  theme
91
- } = _ref12;
97
+ } = _ref13;
92
98
  return theme.breakpoint('small');
93
- }, _ref13 => {
99
+ }, _ref14 => {
94
100
  let {
95
101
  fullImage
96
- } = _ref13;
102
+ } = _ref14;
97
103
  return fullImage ? '100%' : '50%';
98
- }, _ref14 => {
104
+ }, _ref15 => {
99
105
  let {
100
106
  fullImage
101
- } = _ref14;
107
+ } = _ref15;
102
108
  return fullImage ? 'min-height: 500px;' : null;
103
- }, _ref15 => {
109
+ }, _ref16 => {
104
110
  let {
105
111
  vhFull,
106
112
  fullImage
107
- } = _ref15;
113
+ } = _ref16;
108
114
  return vhFull && fullImage ? 'min-height: calc(100vh - 5.625rem);' : null;
109
- }, _ref16 => {
115
+ }, _ref17 => {
110
116
  let {
111
117
  doubleImage
112
- } = _ref16;
118
+ } = _ref17;
113
119
  return doubleImage && 'display: flex; flex-direction: column';
114
- }, _ref17 => {
120
+ }, _ref18 => {
115
121
  let {
116
122
  hasVideo
117
- } = _ref17;
123
+ } = _ref18;
118
124
  return hasVideo ? 'height: auto; overflow: hidden; padding-bottom: 56.25%;' : null;
119
- }, (0, _size.media)('small'), _ref18 => {
125
+ }, (0, _size.media)('small'), _ref19 => {
120
126
  let {
121
127
  landscapeVideo,
122
128
  hasVideo
123
- } = _ref18;
129
+ } = _ref19;
124
130
  return landscapeVideo && hasVideo ? 'calc(56.25% / 2);' : '0;';
125
131
  });
126
132
  const PlayButton = exports.PlayButton = _styledComponents.default.button.withConfig({
127
133
  displayName: "SingleMessagestyle__PlayButton",
128
134
  componentId: "sc-86zg20-3"
129
- })(["", ";cursor:pointer;width:100%;height:100%;position:absolute;top:0;border:0;margin:0;padding:0;text-indent:-9999px;background:rgba(0,0,0,0) center no-repeat;background-size:70px;background-image:", ";", ";display:", ";&:focus,&:hover{background-image:", ";}", "{background-size:100px;}"], (0, _zIndex.default)('medium'), _ref19 => {
135
+ })(["", ";cursor:pointer;width:100%;height:100%;position:absolute;top:0;border:0;margin:0;padding:0;text-indent:-9999px;background:rgba(0,0,0,0) center no-repeat;background-size:70px;background-image:", ";", ";display:", ";&:focus,&:hover{background-image:", ";}", "{background-size:100px;}"], (0, _zIndex.default)('medium'), _ref20 => {
130
136
  let {
131
137
  isBuffering
132
- } = _ref19;
138
+ } = _ref20;
133
139
  return isBuffering === true ? "url(".concat(_loader.default, ")") : "url(".concat(_videoPlayIcon.default, ")");
134
- }, _ref20 => {
140
+ }, _ref21 => {
135
141
  let {
136
142
  copyFirst
137
- } = _ref20;
143
+ } = _ref21;
138
144
  return copyFirst === true ? 'left: auto; right: 0;' : 'left: 0; right: auto;';
139
- }, _ref21 => {
145
+ }, _ref22 => {
140
146
  let {
141
147
  isPlaying
142
- } = _ref21;
148
+ } = _ref22;
143
149
  return isPlaying ? 'none' : 'block';
144
- }, _ref22 => {
150
+ }, _ref23 => {
145
151
  let {
146
152
  isBuffering
147
- } = _ref22;
153
+ } = _ref23;
148
154
  return isBuffering === true ? "url(".concat(_loader.default, ")") : "url(".concat(_videoPlayIcon__hover.default, ")");
149
155
  }, (0, _size.media)('small'));
150
156
  const Image = exports.Image = _styledComponents.default.div.withConfig({
151
157
  displayName: "SingleMessagestyle__Image",
152
158
  componentId: "sc-86zg20-4"
153
- })(["@media ", "{img{position:", ";}}width:100%;height:100%;", ";", ";", ";"], _ref23 => {
159
+ })(["@media ", "{img{position:", ";}}width:100%;height:100%;", ";", ";", ";"], _ref24 => {
154
160
  let {
155
161
  theme
156
- } = _ref23;
162
+ } = _ref24;
157
163
  return theme.breakpoint('small');
158
- }, _ref24 => {
164
+ }, _ref25 => {
159
165
  let {
160
166
  fullImage,
161
167
  vhFull
162
- } = _ref24;
168
+ } = _ref25;
163
169
  return fullImage || vhFull ? 'absolute' : null;
164
- }, _ref25 => {
170
+ }, _ref26 => {
165
171
  let {
166
172
  doubleImage
167
- } = _ref25;
173
+ } = _ref26;
168
174
  return doubleImage && 'height: 50%';
169
- }, _ref26 => {
175
+ }, _ref27 => {
170
176
  let {
171
177
  isPlaying
172
- } = _ref26;
178
+ } = _ref27;
173
179
  return isPlaying ? (0, _zIndex.default)('base') : (0, _zIndex.default)('low');
174
- }, _ref27 => {
180
+ }, _ref28 => {
175
181
  let {
176
182
  hasVideo
177
- } = _ref27;
183
+ } = _ref28;
178
184
  return hasVideo ? 'position: absolute; top: 0; left: 0;' : null;
179
185
  });
180
186
  const VideoWrapper = exports.VideoWrapper = _styledComponents.default.div.withConfig({
181
187
  displayName: "SingleMessagestyle__VideoWrapper",
182
188
  componentId: "sc-86zg20-5"
183
- })(["width:100%;height:100%;position:absolute;top:0;left:0;", ";"], _ref28 => {
189
+ })(["width:100%;height:100%;position:absolute;top:0;left:0;", ";"], _ref29 => {
184
190
  let {
185
191
  isPlaying
186
- } = _ref28;
192
+ } = _ref29;
187
193
  return isPlaying ? (0, _zIndex.default)('medium') : (0, _zIndex.default)('base');
188
194
  });
@@ -104,6 +104,10 @@ exports[`renders Single Message with 100% vertical height image correctly 1`] =
104
104
  }
105
105
  }
106
106
 
107
+ @media (min-width:1024px) {
108
+
109
+ }
110
+
107
111
  @media (min-width:740px) {
108
112
  .c1 {
109
113
  height: auto;
@@ -312,6 +316,10 @@ exports[`renders Single Message with Image correctly 1`] = `
312
316
  }
313
317
  }
314
318
 
319
+ @media (min-width:1024px) {
320
+
321
+ }
322
+
315
323
  @media (min-width:740px) {
316
324
  .c1 {
317
325
  height: auto;
@@ -498,6 +506,10 @@ exports[`renders Single Message with double image correctly 1`] = `
498
506
  }
499
507
  }
500
508
 
509
+ @media (min-width:1024px) {
510
+
511
+ }
512
+
501
513
  @media (min-width:740px) {
502
514
 
503
515
  }
@@ -506,6 +518,10 @@ exports[`renders Single Message with double image correctly 1`] = `
506
518
 
507
519
  }
508
520
 
521
+ @media (min-width:1024px) {
522
+
523
+ }
524
+
509
525
  @media (min-width:740px) {
510
526
  .c1 {
511
527
  height: auto;
@@ -766,6 +782,10 @@ exports[`renders Single Message with full width correctly 1`] = `
766
782
  }
767
783
  }
768
784
 
785
+ @media (min-width:1024px) {
786
+
787
+ }
788
+
769
789
  @media (min-width:740px) {
770
790
  .c1 {
771
791
  height: auto;
@@ -920,6 +940,10 @@ exports[`renders Single Message with full width image and no text correctly 1`]
920
940
 
921
941
  }
922
942
 
943
+ @media (min-width:1024px) {
944
+
945
+ }
946
+
923
947
  @media (min-width:740px) {
924
948
  .c1 {
925
949
  height: auto;
@@ -1052,6 +1076,10 @@ exports[`renders Single Message with no Image correctly 1`] = `
1052
1076
  }
1053
1077
  }
1054
1078
 
1079
+ @media (min-width:1024px) {
1080
+
1081
+ }
1082
+
1055
1083
  @media (min-width:740px) {
1056
1084
 
1057
1085
  }
@@ -1060,6 +1088,10 @@ exports[`renders Single Message with no Image correctly 1`] = `
1060
1088
 
1061
1089
  }
1062
1090
 
1091
+ @media (min-width:1024px) {
1092
+
1093
+ }
1094
+
1063
1095
  @media (min-width:740px) {
1064
1096
 
1065
1097
  }
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.32.0",
4
+ "version": "7.33.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -30,7 +30,8 @@ const SingleMessage = ({
30
30
  fullImage,
31
31
  vhFull,
32
32
  videoID,
33
- landscapeVideo
33
+ landscapeVideo,
34
+ paddingOption
34
35
  }) => {
35
36
  const hasImage = imageSet || false;
36
37
  const doubleImage = (imageSet || image) && (imageSet2 || image2);
@@ -207,6 +208,7 @@ const SingleMessage = ({
207
208
  copyFirst={copyFirst}
208
209
  hasVideo={hasVideo}
209
210
  vhFull={vhFull}
211
+ paddingOption={paddingOption}
210
212
  >
211
213
  {children}
212
214
  </Copy>
@@ -234,7 +236,8 @@ SingleMessage.propTypes = {
234
236
  /** Image will be the height of the viewport */
235
237
  vhFull: PropTypes.bool,
236
238
  videoID: PropTypes.string,
237
- landscapeVideo: PropTypes.bool
239
+ landscapeVideo: PropTypes.bool,
240
+ paddingOption: PropTypes.string
238
241
  };
239
242
 
240
243
  SingleMessage.defaultProps = {
@@ -251,7 +254,8 @@ SingleMessage.defaultProps = {
251
254
  children: null,
252
255
  vhFull: false,
253
256
  videoID: null,
254
- landscapeVideo: false
257
+ landscapeVideo: false,
258
+ paddingOption: null
255
259
  };
256
260
 
257
261
  export default SingleMessage;
@@ -84,6 +84,59 @@ import Text from '../../Atoms/Text/Text';
84
84
  </SingleMessage>;
85
85
  ```
86
86
 
87
+ Single Message with no Image - padding unmodified
88
+
89
+ ```js
90
+ import Text from '../../Atoms/Text/Text';
91
+
92
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="both_on">
93
+ <Text tag="p" color="white" size="xxl">
94
+ “The creativity that goes into helping people have a better life is
95
+ extraordinary.”
96
+ </Text>
97
+ </SingleMessage>;
98
+ ```
99
+
100
+ Single Message with no Image - no bottom padding
101
+
102
+ ```js
103
+ import Text from '../../Atoms/Text/Text';
104
+
105
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="lower_off">
106
+ <Text tag="p" color="white" size="xxl">
107
+ “The creativity that goes into helping people have a better life is
108
+ extraordinary.”
109
+ </Text>
110
+ </SingleMessage>;
111
+ ```
112
+
113
+
114
+ Single Message with no Image - no top padding
115
+
116
+ ```js
117
+ import Text from '../../Atoms/Text/Text';
118
+
119
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="upper_off">
120
+ <Text tag="p" color="white" size="xxl">
121
+ “The creativity that goes into helping people have a better life is
122
+ extraordinary.”
123
+ </Text>
124
+ </SingleMessage>;
125
+ ```
126
+
127
+ Single Message with no Image - no top and bottom padding
128
+
129
+ ```js
130
+ import Text from '../../Atoms/Text/Text';
131
+
132
+ <SingleMessage backgroundColor="purple_dark" copyFirst={false} paddingOption="both_off">
133
+ <Text tag="p" color="white" size="xxl">
134
+ “The creativity that goes into helping people have a better life is
135
+ extraordinary.”
136
+ </Text>
137
+ </SingleMessage>;
138
+ ```
139
+
87
140
  Single Message vertical height 100%
88
141
 
89
142
  ```js
@@ -5,6 +5,7 @@ import zIndex from '../../../theme/shared/zIndex';
5
5
  import playIcon from './assets/video--play-icon.svg';
6
6
  import playIconHover from './assets/video--play-icon__hover.svg';
7
7
  import loadingIcon from './assets/loader.svg';
8
+ import handlePadding from '../../../utils/_utils';
8
9
 
9
10
  const Container = styled.div`
10
11
  display: flex;
@@ -31,6 +32,7 @@ const Copy = styled.div`
31
32
  ${zIndex('low')};
32
33
  ${({ hasVideo, fullImage }) => (hasVideo === true && fullImage === true ? 'display: none;' : null)};
33
34
  padding: ${spacing('l')};
35
+
34
36
  ${media('small')} {
35
37
  ${({ vhFull, fullImage }) => (vhFull || fullImage
36
38
  ? 'min-height: calc(100vh - 5.625rem); flex-direction: column; justify-content: center;'
@@ -44,6 +46,7 @@ const Copy = styled.div`
44
46
  justify-content: center;
45
47
  padding: ${spacing('xl')};
46
48
  }
49
+
47
50
  ${props => props.fullImage
48
51
  && css`
49
52
  ${media('small')} {
@@ -52,17 +55,13 @@ const Copy = styled.div`
52
55
  right: 0;
53
56
  top: 50%;
54
57
  transform: translateY(-50%);
55
- ${props.copyFirst
56
- ? css`
57
- left: 0;
58
- `
59
- : null}
58
+ ${props.copyFirst ? css`left: 0;` : null}
60
59
  width: 50%;
61
60
  }
62
61
  `};
62
+
63
63
  ${props => (props.hasImage
64
- ? css`
65
- @media ${({ theme }) => theme.breakpoint('small')} {
64
+ ? css`@media ${({ theme }) => theme.breakpoint('small')} {
66
65
  width: 50%;
67
66
  }
68
67
  `
@@ -75,6 +74,10 @@ const Copy = styled.div`
75
74
  margin: auto;
76
75
  padding: ${spacing('md')};
77
76
  `)};
77
+
78
+ ${media('medium')} {
79
+ ${({ paddingOption }) => handlePadding(paddingOption)};
80
+ }
78
81
  `;
79
82
 
80
83
  const Media = styled.div`
@@ -104,6 +104,10 @@ exports[`renders Single Message with 100% vertical height image correctly 1`] =
104
104
  }
105
105
  }
106
106
 
107
+ @media (min-width:1024px) {
108
+
109
+ }
110
+
107
111
  @media (min-width:740px) {
108
112
  .c1 {
109
113
  height: auto;
@@ -312,6 +316,10 @@ exports[`renders Single Message with Image correctly 1`] = `
312
316
  }
313
317
  }
314
318
 
319
+ @media (min-width:1024px) {
320
+
321
+ }
322
+
315
323
  @media (min-width:740px) {
316
324
  .c1 {
317
325
  height: auto;
@@ -498,6 +506,10 @@ exports[`renders Single Message with double image correctly 1`] = `
498
506
  }
499
507
  }
500
508
 
509
+ @media (min-width:1024px) {
510
+
511
+ }
512
+
501
513
  @media (min-width:740px) {
502
514
 
503
515
  }
@@ -506,6 +518,10 @@ exports[`renders Single Message with double image correctly 1`] = `
506
518
 
507
519
  }
508
520
 
521
+ @media (min-width:1024px) {
522
+
523
+ }
524
+
509
525
  @media (min-width:740px) {
510
526
  .c1 {
511
527
  height: auto;
@@ -766,6 +782,10 @@ exports[`renders Single Message with full width correctly 1`] = `
766
782
  }
767
783
  }
768
784
 
785
+ @media (min-width:1024px) {
786
+
787
+ }
788
+
769
789
  @media (min-width:740px) {
770
790
  .c1 {
771
791
  height: auto;
@@ -920,6 +940,10 @@ exports[`renders Single Message with full width image and no text correctly 1`]
920
940
 
921
941
  }
922
942
 
943
+ @media (min-width:1024px) {
944
+
945
+ }
946
+
923
947
  @media (min-width:740px) {
924
948
  .c1 {
925
949
  height: auto;
@@ -1052,6 +1076,10 @@ exports[`renders Single Message with no Image correctly 1`] = `
1052
1076
  }
1053
1077
  }
1054
1078
 
1079
+ @media (min-width:1024px) {
1080
+
1081
+ }
1082
+
1055
1083
  @media (min-width:740px) {
1056
1084
 
1057
1085
  }
@@ -1060,6 +1088,10 @@ exports[`renders Single Message with no Image correctly 1`] = `
1060
1088
 
1061
1089
  }
1062
1090
 
1091
+ @media (min-width:1024px) {
1092
+
1093
+ }
1094
+
1063
1095
  @media (min-width:740px) {
1064
1096
 
1065
1097
  }