@comicrelief/component-library 5.8.4 → 5.8.7
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.
- package/cypress/integration/components/Molecules/CardDs.spec.js +220 -176
- package/dist/components/Molecules/CardDs/CardDs.js +37 -46
- package/dist/components/Molecules/CardDs/CardDs.md +36 -4
- package/dist/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +1 -14
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +1 -1
- package/dist/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +2 -1
- package/dist/components/Organisms/Donate/Form/Form.js +6 -2
- package/docs/installation.md +3 -3
- package/package.json +1 -1
- package/src/components/Molecules/CardDs/CardDs.js +1 -9
- package/src/components/Molecules/CardDs/CardDs.md +36 -4
- package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +1 -14
- package/src/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +2 -1
- package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +2 -1
- package/src/components/Organisms/Donate/Form/Form.js +8 -1
- package/styleguide.config.js +1 -1
|
@@ -1,179 +1,223 @@
|
|
|
1
1
|
describe('CardDs component', () => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('is present', () => {
|
|
20
|
-
cy.get('@propsBtn').should('exist');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('does not show table initially', () => {
|
|
24
|
-
cy.get('@container')
|
|
25
|
-
.find('table')
|
|
26
|
-
.should('not.exist');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('shows the table on button click', () => {
|
|
30
|
-
cy.get('@propsBtn').click();
|
|
31
|
-
cy.get('@container')
|
|
32
|
-
.find('table')
|
|
33
|
-
.should('contain', 'Prop name');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('CardDs image and CTA section', () => {
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
cy.get('[data-testid="CardDs-example-1"]')
|
|
40
|
-
.as('container')
|
|
41
|
-
.find('[data-preview="CardDs"]')
|
|
42
|
-
.as('preview');
|
|
43
|
-
|
|
44
|
-
cy.get('@container')
|
|
45
|
-
.find('button')
|
|
46
|
-
.contains('View Code')
|
|
47
|
-
.as('viewCodeBtn');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('renders cardDs image and CTA preview', () => {
|
|
51
|
-
cy.get('@container')
|
|
52
|
-
.find('h3')
|
|
53
|
-
.should('exist')
|
|
54
|
-
.contains('Title');
|
|
55
|
-
cy.get('@container')
|
|
56
|
-
.find('p')
|
|
57
|
-
.should('exist')
|
|
58
|
-
.contains('Text body copy description');
|
|
59
|
-
cy.get('@container')
|
|
60
|
-
.find('a')
|
|
61
|
-
.should('exist')
|
|
62
|
-
.contains('find out more');
|
|
63
|
-
cy.get('@container')
|
|
64
|
-
.find('img')
|
|
65
|
-
.should('exist')
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('has view code button', () => {
|
|
69
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('shows code on click', () => {
|
|
73
|
-
cy.get('@viewCodeBtn').click();
|
|
74
|
-
cy.get('@container')
|
|
75
|
-
.find('textarea')
|
|
76
|
-
.should('exist');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('closes code on click', () => {
|
|
80
|
-
cy.get('@viewCodeBtn').click();
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe('CardDs no Image with link section', () => {
|
|
85
|
-
beforeEach(() => {
|
|
86
|
-
cy.get('[data-testid="CardDs-example-3"]')
|
|
87
|
-
.as('container')
|
|
88
|
-
.find('[data-preview="CardDs"]')
|
|
89
|
-
.as('preview');
|
|
90
|
-
|
|
91
|
-
cy.get('@container')
|
|
92
|
-
.find('button')
|
|
93
|
-
.contains('View Code')
|
|
94
|
-
.as('viewCodeBtn');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('renders card no image with link preview', () => {
|
|
98
|
-
cy.get('@container')
|
|
99
|
-
.find('h3')
|
|
100
|
-
.should('exist')
|
|
101
|
-
.contains('Title');
|
|
102
|
-
cy.get('@container')
|
|
103
|
-
.find('p')
|
|
104
|
-
.should('exist')
|
|
105
|
-
.contains('Text body copy description');
|
|
106
|
-
cy.get('@container')
|
|
107
|
-
.find('a')
|
|
108
|
-
.should('exist')
|
|
109
|
-
.contains('find out more');
|
|
110
|
-
cy.get('@container')
|
|
111
|
-
.find('img')
|
|
112
|
-
.should('not.exist')
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('has view code button', () => {
|
|
116
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('shows code on click', () => {
|
|
120
|
-
cy.get('@viewCodeBtn').click();
|
|
121
|
-
cy.get('@container')
|
|
122
|
-
.find('textarea')
|
|
123
|
-
.should('exist');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('closes code on click', () => {
|
|
127
|
-
cy.get('@viewCodeBtn').click();
|
|
128
|
-
cy.get('@container')
|
|
129
|
-
.find('textarea')
|
|
130
|
-
.should('not.exist');
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
describe('CardDs no image no link section', () => {
|
|
135
|
-
beforeEach(() => {
|
|
136
|
-
cy.get('[data-testid="CardDs-example-5"]')
|
|
137
|
-
.as('container')
|
|
138
|
-
.find('[data-preview="CardDs"]')
|
|
139
|
-
.as('preview');
|
|
140
|
-
|
|
141
|
-
cy.get('@container')
|
|
142
|
-
.find('button')
|
|
143
|
-
.contains('View Code')
|
|
144
|
-
.as('viewCodeBtn');
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('renders cardDs no image no link preview', () => {
|
|
148
|
-
cy.get('@container')
|
|
149
|
-
.find('h3')
|
|
150
|
-
.should('exist')
|
|
151
|
-
.contains('Title');
|
|
152
|
-
cy.get('@container')
|
|
153
|
-
.find('p')
|
|
154
|
-
.should('exist')
|
|
155
|
-
.contains('Text body copy description');
|
|
156
|
-
cy.get('@container')
|
|
157
|
-
.find('img')
|
|
158
|
-
.should('not.exist')
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('has view code button', () => {
|
|
162
|
-
cy.get('@viewCodeBtn').should('exist');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('shows code on click', () => {
|
|
166
|
-
cy.get('@viewCodeBtn').click();
|
|
167
|
-
cy.get('@container')
|
|
168
|
-
.find('textarea')
|
|
169
|
-
.should('exist');
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('closes code on click', () => {
|
|
173
|
-
cy.get('@viewCodeBtn').click();
|
|
174
|
-
cy.get('@container')
|
|
175
|
-
.find('textarea')
|
|
176
|
-
.should('not.exist');
|
|
177
|
-
});
|
|
2
|
+
before(() => {
|
|
3
|
+
// go to cardDs component
|
|
4
|
+
cy.visit('/#cardds');
|
|
5
|
+
cy.wait(2500);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe('props and methods section', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
cy.get('[data-testid="CardDs-container"] button[name="rsg-usage"]')
|
|
11
|
+
.contains('Props & methods')
|
|
12
|
+
.as('propsBtn');
|
|
13
|
+
|
|
14
|
+
cy.get('@propsBtn')
|
|
15
|
+
.closest('[class^=rsg--tabs]')
|
|
16
|
+
.as('container');
|
|
178
17
|
});
|
|
18
|
+
|
|
19
|
+
it('is present', () => {
|
|
20
|
+
cy.get('@propsBtn').should('exist');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('does not show table initially', () => {
|
|
24
|
+
cy.get('@container')
|
|
25
|
+
.find('table')
|
|
26
|
+
.should('not.exist');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('shows the table on button click', () => {
|
|
30
|
+
cy.get('@propsBtn').click();
|
|
31
|
+
cy.get('@container')
|
|
32
|
+
.find('table')
|
|
33
|
+
.should('contain', 'Prop name');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('CardDs image and CTA section', () => {
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
cy.get('[data-testid="CardDs-example-1"]')
|
|
40
|
+
.as('container')
|
|
41
|
+
.find('[data-preview="CardDs"]')
|
|
42
|
+
.as('preview');
|
|
43
|
+
|
|
44
|
+
cy.get('@container')
|
|
45
|
+
.find('button')
|
|
46
|
+
.contains('View Code')
|
|
47
|
+
.as('viewCodeBtn');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('renders cardDs image and CTA preview', () => {
|
|
51
|
+
cy.get('@container')
|
|
52
|
+
.find('h3')
|
|
53
|
+
.should('exist')
|
|
54
|
+
.contains('Title');
|
|
55
|
+
cy.get('@container')
|
|
56
|
+
.find('p')
|
|
57
|
+
.should('exist')
|
|
58
|
+
.contains('Text body copy description');
|
|
59
|
+
cy.get('@container')
|
|
60
|
+
.find('a')
|
|
61
|
+
.should('exist')
|
|
62
|
+
.contains('find out more');
|
|
63
|
+
cy.get('@container')
|
|
64
|
+
.find('img')
|
|
65
|
+
.should('exist');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('has view code button', () => {
|
|
69
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('shows code on click', () => {
|
|
73
|
+
cy.get('@viewCodeBtn').click();
|
|
74
|
+
cy.get('@container')
|
|
75
|
+
.find('textarea')
|
|
76
|
+
.should('exist');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('closes code on click', () => {
|
|
80
|
+
cy.get('@viewCodeBtn').click();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('CardDs no Image with link section', () => {
|
|
85
|
+
beforeEach(() => {
|
|
86
|
+
cy.get('[data-testid="CardDs-example-3"]')
|
|
87
|
+
.as('container')
|
|
88
|
+
.find('[data-preview="CardDs"]')
|
|
89
|
+
.as('preview');
|
|
90
|
+
|
|
91
|
+
cy.get('@container')
|
|
92
|
+
.find('button')
|
|
93
|
+
.contains('View Code')
|
|
94
|
+
.as('viewCodeBtn');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('renders card no image with link preview', () => {
|
|
98
|
+
cy.get('@container')
|
|
99
|
+
.find('h3')
|
|
100
|
+
.should('exist')
|
|
101
|
+
.contains('Title');
|
|
102
|
+
cy.get('@container')
|
|
103
|
+
.find('p')
|
|
104
|
+
.should('exist')
|
|
105
|
+
.contains('Text body copy description');
|
|
106
|
+
cy.get('@container')
|
|
107
|
+
.find('a')
|
|
108
|
+
.should('exist')
|
|
109
|
+
.contains('find out more');
|
|
110
|
+
cy.get('@container')
|
|
111
|
+
.find('img')
|
|
112
|
+
.should('not.exist');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('has view code button', () => {
|
|
116
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('shows code on click', () => {
|
|
120
|
+
cy.get('@viewCodeBtn').click();
|
|
121
|
+
cy.get('@container')
|
|
122
|
+
.find('textarea')
|
|
123
|
+
.should('exist');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('closes code on click', () => {
|
|
127
|
+
cy.get('@viewCodeBtn').click();
|
|
128
|
+
cy.get('@container')
|
|
129
|
+
.find('textarea')
|
|
130
|
+
.should('not.exist');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe('CardDs no image no link section', () => {
|
|
135
|
+
beforeEach(() => {
|
|
136
|
+
cy.get('[data-testid="CardDs-example-5"]')
|
|
137
|
+
.as('container')
|
|
138
|
+
.find('[data-preview="CardDs"]')
|
|
139
|
+
.as('preview');
|
|
140
|
+
|
|
141
|
+
cy.get('@container')
|
|
142
|
+
.find('button')
|
|
143
|
+
.contains('View Code')
|
|
144
|
+
.as('viewCodeBtn');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('renders cardDs no image no link preview', () => {
|
|
148
|
+
cy.get('@container')
|
|
149
|
+
.find('h3')
|
|
150
|
+
.should('exist')
|
|
151
|
+
.contains('Title');
|
|
152
|
+
cy.get('@container')
|
|
153
|
+
.find('p')
|
|
154
|
+
.should('exist')
|
|
155
|
+
.contains('Text body copy description');
|
|
156
|
+
cy.get('@container')
|
|
157
|
+
.find('img')
|
|
158
|
+
.should('not.exist');
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('has view code button', () => {
|
|
162
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('shows code on click', () => {
|
|
166
|
+
cy.get('@viewCodeBtn').click();
|
|
167
|
+
cy.get('@container')
|
|
168
|
+
.find('textarea')
|
|
169
|
+
.should('exist');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('closes code on click', () => {
|
|
173
|
+
cy.get('@viewCodeBtn').click();
|
|
174
|
+
cy.get('@container')
|
|
175
|
+
.find('textarea')
|
|
176
|
+
.should('not.exist');
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('CardDs image, text, no link', () => {
|
|
181
|
+
beforeEach(() => {
|
|
182
|
+
// Here
|
|
183
|
+
cy.get('[data-testid="CardDs-example-7"]')
|
|
184
|
+
.as('container')
|
|
185
|
+
.find('[data-preview="CardDs"]')
|
|
186
|
+
.as('preview');
|
|
187
|
+
|
|
188
|
+
cy.get('@container')
|
|
189
|
+
.find('button')
|
|
190
|
+
.contains('View Code')
|
|
191
|
+
.as('viewCodeBtn');
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it('renders cardDs image and CTA preview', () => {
|
|
195
|
+
cy.get('@container')
|
|
196
|
+
.find('h3')
|
|
197
|
+
.should('exist')
|
|
198
|
+
.contains('Title');
|
|
199
|
+
cy.get('@container')
|
|
200
|
+
.find('p')
|
|
201
|
+
.should('exist')
|
|
202
|
+
.contains('Text body copy description');
|
|
203
|
+
cy.get('@container')
|
|
204
|
+
.find('img')
|
|
205
|
+
.should('exist');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('has view code button', () => {
|
|
209
|
+
cy.get('@viewCodeBtn').should('exist');
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('shows code on click', () => {
|
|
213
|
+
cy.get('@viewCodeBtn').click();
|
|
214
|
+
cy.get('@container')
|
|
215
|
+
.find('textarea')
|
|
216
|
+
.should('exist');
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('closes code on click', () => {
|
|
220
|
+
cy.get('@viewCodeBtn').click();
|
|
221
|
+
});
|
|
222
|
+
});
|
|
179
223
|
});
|
|
@@ -30,7 +30,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
30
|
var Container = _styledComponents.default.div.withConfig({
|
|
31
31
|
displayName: "CardDs__Container",
|
|
32
32
|
componentId: "sc-mayd3d-0"
|
|
33
|
-
})(["display:flex;position:relative;flex-direction:column;height:100%;width:
|
|
33
|
+
})(["display:flex;position:relative;flex-direction:column;height:100%;width:100%;background:", ";@media ", "{flex-direction:row;}@media ", "{flex-direction:column;}"], function (_ref) {
|
|
34
34
|
var theme = _ref.theme,
|
|
35
35
|
backgroundColor = _ref.backgroundColor;
|
|
36
36
|
return theme.color(backgroundColor);
|
|
@@ -45,48 +45,39 @@ var Container = _styledComponents.default.div.withConfig({
|
|
|
45
45
|
var Image = _styledComponents.default.div.withConfig({
|
|
46
46
|
displayName: "CardDs__Image",
|
|
47
47
|
componentId: "sc-mayd3d-1"
|
|
48
|
-
})(["height:auto;margin:0 -", " 0 ", "
|
|
49
|
-
var theme = _ref4.theme;
|
|
50
|
-
return theme.breakpoint('small');
|
|
51
|
-
}, function (_ref5) {
|
|
52
|
-
var hasLink = _ref5.hasLink;
|
|
53
|
-
return !hasLink && "width: calc(50% - ".concat((0, _spacing.default)('xl'), ")");
|
|
54
|
-
}, function (_ref6) {
|
|
55
|
-
var theme = _ref6.theme;
|
|
56
|
-
return theme.breakpoint('large');
|
|
57
|
-
}, (0, _spacing.default)('m'), (0, _spacing.default)('m'));
|
|
48
|
+
})(["height:auto;margin:0 -", " 0 ", ";img{border-radius:1rem;box-shadow:0px 0px 20px rgba(0,0,0,0.15);}"], (0, _spacing.default)('m'), (0, _spacing.default)('m'));
|
|
58
49
|
|
|
59
50
|
var MediaLink = _styledComponents.default.a.withConfig({
|
|
60
51
|
displayName: "CardDs__MediaLink",
|
|
61
52
|
componentId: "sc-mayd3d-2"
|
|
62
|
-
})(["width:100%;@media ", "{width:calc(50% + 6rem);}@media ", "{width:100%;}"], function (
|
|
63
|
-
var theme =
|
|
53
|
+
})(["width:100%;@media ", "{width:calc(50% + 6rem);}@media ", "{width:100%;}"], function (_ref4) {
|
|
54
|
+
var theme = _ref4.theme;
|
|
64
55
|
return theme.breakpoint('small');
|
|
65
|
-
}, function (
|
|
66
|
-
var theme =
|
|
56
|
+
}, function (_ref5) {
|
|
57
|
+
var theme = _ref5.theme;
|
|
67
58
|
return theme.breakpoint('large');
|
|
68
59
|
});
|
|
69
60
|
|
|
70
61
|
var Copy = _styledComponents.default.div.withConfig({
|
|
71
62
|
displayName: "CardDs__Copy",
|
|
72
63
|
componentId: "sc-mayd3d-3"
|
|
73
|
-
})(["padding:", ";", ";display:flex;flex-direction:column;border-radius:1rem;box-shadow:0px 0px 20px rgba(0,0,0,0.15);background:", ";width:100%;@media ", "{height:100%;}", ";", ";"], (0, _spacing.default)('l'), function (
|
|
74
|
-
var hasLink =
|
|
64
|
+
})(["padding:", ";", ";display:flex;flex-direction:column;border-radius:1rem;box-shadow:0px 0px 20px rgba(0,0,0,0.15);background:", ";width:100%;@media ", "{height:100%;}", ";", ";"], (0, _spacing.default)('l'), function (_ref6) {
|
|
65
|
+
var hasLink = _ref6.hasLink;
|
|
75
66
|
return hasLink && "padding-bottom: ".concat((0, _spacing.default)('xl'));
|
|
76
|
-
}, function (
|
|
77
|
-
var theme =
|
|
78
|
-
backgroundColor =
|
|
67
|
+
}, function (_ref7) {
|
|
68
|
+
var theme = _ref7.theme,
|
|
69
|
+
backgroundColor = _ref7.backgroundColor;
|
|
79
70
|
return theme.color(backgroundColor);
|
|
80
|
-
}, function (
|
|
81
|
-
var theme =
|
|
71
|
+
}, function (_ref8) {
|
|
72
|
+
var theme = _ref8.theme;
|
|
82
73
|
return theme.breakpoint('large');
|
|
83
|
-
}, (0, _zIndex.default)('low'), function (
|
|
84
|
-
var hasImage =
|
|
85
|
-
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'), function (
|
|
86
|
-
var theme =
|
|
74
|
+
}, (0, _zIndex.default)('low'), function (_ref9) {
|
|
75
|
+
var hasImage = _ref9.hasImage;
|
|
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'), function (_ref10) {
|
|
77
|
+
var theme = _ref10.theme;
|
|
87
78
|
return theme.breakpoint('small');
|
|
88
|
-
}, (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('m'), function (
|
|
89
|
-
var theme =
|
|
79
|
+
}, (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _spacing.default)('m'), function (_ref11) {
|
|
80
|
+
var theme = _ref11.theme;
|
|
90
81
|
return theme.breakpoint('large');
|
|
91
82
|
}, (0, _spacing.default)('m'), (0, _spacing.default)('m'));
|
|
92
83
|
});
|
|
@@ -94,28 +85,28 @@ var Copy = _styledComponents.default.div.withConfig({
|
|
|
94
85
|
var CTA = _styledComponents.default.div.withConfig({
|
|
95
86
|
displayName: "CardDs__CTA",
|
|
96
87
|
componentId: "sc-mayd3d-4"
|
|
97
|
-
})(["position:absolute;right:", ";bottom:-", ";", ";@media ", "{bottom:calc(-1 * (", " + ", "));", ";}"], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _zIndex.default)('medium'), function (
|
|
98
|
-
var theme =
|
|
88
|
+
})(["position:absolute;right:", ";bottom:-", ";", ";@media ", "{bottom:calc(-1 * (", " + ", "));", ";}"], (0, _spacing.default)('m'), (0, _spacing.default)('m'), (0, _zIndex.default)('medium'), function (_ref12) {
|
|
89
|
+
var theme = _ref12.theme;
|
|
99
90
|
return theme.breakpoint('small');
|
|
100
|
-
}, (0, _spacing.default)('l'), (0, _spacing.default)('md'), function (
|
|
101
|
-
var hasImage =
|
|
91
|
+
}, (0, _spacing.default)('l'), (0, _spacing.default)('md'), function (_ref13) {
|
|
92
|
+
var hasImage = _ref13.hasImage;
|
|
102
93
|
return !hasImage && "bottom: -".concat((0, _spacing.default)('m'), ";");
|
|
103
94
|
});
|
|
104
95
|
|
|
105
|
-
var CardDs = function CardDs(
|
|
106
|
-
var icon =
|
|
107
|
-
backgroundColor =
|
|
108
|
-
imageLow =
|
|
109
|
-
images =
|
|
110
|
-
image =
|
|
111
|
-
imageAltText =
|
|
112
|
-
height =
|
|
113
|
-
width =
|
|
114
|
-
children =
|
|
115
|
-
link =
|
|
116
|
-
linkLabel =
|
|
117
|
-
target =
|
|
118
|
-
rest = (0, _objectWithoutProperties2.default)(
|
|
96
|
+
var CardDs = function CardDs(_ref14) {
|
|
97
|
+
var icon = _ref14.icon,
|
|
98
|
+
backgroundColor = _ref14.backgroundColor,
|
|
99
|
+
imageLow = _ref14.imageLow,
|
|
100
|
+
images = _ref14.images,
|
|
101
|
+
image = _ref14.image,
|
|
102
|
+
imageAltText = _ref14.imageAltText,
|
|
103
|
+
height = _ref14.height,
|
|
104
|
+
width = _ref14.width,
|
|
105
|
+
children = _ref14.children,
|
|
106
|
+
link = _ref14.link,
|
|
107
|
+
linkLabel = _ref14.linkLabel,
|
|
108
|
+
target = _ref14.target,
|
|
109
|
+
rest = (0, _objectWithoutProperties2.default)(_ref14, _excluded);
|
|
119
110
|
|
|
120
111
|
var Media = /*#__PURE__*/_react.default.createElement(Image, {
|
|
121
112
|
hasLink: link
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# CardDs
|
|
2
|
+
## Image and CTA are clickable and links user through to full content
|
|
2
3
|
|
|
3
|
-
## Image and CTA are clickable and links user through to full conten
|
|
4
4
|
|
|
5
|
+
### CardDs: Image, Text & Link
|
|
5
6
|
```js
|
|
6
7
|
const data = require('../../../styleguide/data/data').default;
|
|
7
8
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -35,8 +36,8 @@ import { Internal } from '../../Atoms/Icons/index';
|
|
|
35
36
|
</div>;
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
### CardDs no Image with Link
|
|
39
39
|
|
|
40
|
+
### CardDs: Text & Link
|
|
40
41
|
```js
|
|
41
42
|
const data = require('../../../styleguide/data/data').default;
|
|
42
43
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -67,8 +68,7 @@ import { Download } from '../../Atoms/Icons/index';
|
|
|
67
68
|
</div>;
|
|
68
69
|
```
|
|
69
70
|
|
|
70
|
-
### CardDs
|
|
71
|
-
|
|
71
|
+
### CardDs: Text only
|
|
72
72
|
```js
|
|
73
73
|
const data = require('../../../styleguide/data/data').default;
|
|
74
74
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -89,3 +89,35 @@ import Link from '../../Atoms/Link/Link';
|
|
|
89
89
|
</CardDs>
|
|
90
90
|
</div>;
|
|
91
91
|
```
|
|
92
|
+
|
|
93
|
+
### CardDs: Image & Text, No Link
|
|
94
|
+
```js
|
|
95
|
+
const data = require('../../../styleguide/data/data').default;
|
|
96
|
+
import Text from '../../Atoms/Text/Text';
|
|
97
|
+
import Link from '../../Atoms/Link/Link';
|
|
98
|
+
import { Internal } from '../../Atoms/Icons/index';
|
|
99
|
+
|
|
100
|
+
<div
|
|
101
|
+
style={{
|
|
102
|
+
display: 'flex',
|
|
103
|
+
padding: '2rem 0',
|
|
104
|
+
background: '#E1E2E3',
|
|
105
|
+
justifyContent: 'space-around'
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<CardDs
|
|
109
|
+
target="_blank"
|
|
110
|
+
imageLow={data.image}
|
|
111
|
+
images={data.images}
|
|
112
|
+
imageAltText="Happy man going to work"
|
|
113
|
+
backgroundColor="white"
|
|
114
|
+
height="auto"
|
|
115
|
+
icon={<Internal colour="white" />}
|
|
116
|
+
>
|
|
117
|
+
<Text tag="h3" color="purple" size="xl">
|
|
118
|
+
Title
|
|
119
|
+
</Text>
|
|
120
|
+
<Text tag="p">Text body copy description</Text>
|
|
121
|
+
</CardDs>
|
|
122
|
+
</div>;
|
|
123
|
+
```
|
|
@@ -71,7 +71,7 @@ exports[`renders correctly 1`] = `
|
|
|
71
71
|
-ms-flex-direction: column;
|
|
72
72
|
flex-direction: column;
|
|
73
73
|
height: 100%;
|
|
74
|
-
width:
|
|
74
|
+
width: 100%;
|
|
75
75
|
background: inherit;
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -134,7 +134,6 @@ exports[`renders correctly 1`] = `
|
|
|
134
134
|
-webkit-flex-direction: row;
|
|
135
135
|
-ms-flex-direction: row;
|
|
136
136
|
flex-direction: row;
|
|
137
|
-
width: 100%;
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
|
|
@@ -146,18 +145,6 @@ exports[`renders correctly 1`] = `
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
|
|
149
|
-
@media (min-width:740px) {
|
|
150
|
-
.c2 {
|
|
151
|
-
margin: 0;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@media (min-width:1440px) {
|
|
156
|
-
.c2 {
|
|
157
|
-
margin: 0 -1.5rem 0 1.5rem;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
148
|
@media (min-width:740px) {
|
|
162
149
|
.c1 {
|
|
163
150
|
width: calc(50% + 6rem);
|
|
@@ -102,7 +102,7 @@ exports.CTA = CTA;
|
|
|
102
102
|
var Copy = _styledComponents.default.div.withConfig({
|
|
103
103
|
displayName: "SingleMessageDsstyle__Copy",
|
|
104
104
|
componentId: "sc-s8zd7s-8"
|
|
105
|
-
})(["position:relative;height:auto;padding:", ";", ";display:flex;flex-direction:column;border-radius:1rem;", ";background:", ";", ";", ";@media ", "{height:448px;width:calc(50% + 1.5rem);flex-grow:0;flex-shrink:0;flex-basis:calc(50% + 1.5rem);padding:", ";", ";", ";}@media ", "{padding:calc(", " * 2);", ";margin:", ";}"], (0, _spacing.default)('m'), (0, _zIndex.default)('low'), boxShadow, function (_ref10) {
|
|
105
|
+
})(["position:relative;height:auto;padding:", ";", ";display:flex;flex-direction:column;border-radius:1rem;", ";background:", ";", ";", ";@media ", "{min-height:448px;height:auto;width:calc(50% + 1.5rem);flex-grow:0;flex-shrink:0;flex-basis:calc(50% + 1.5rem);padding:", ";", ";", ";}@media ", "{padding:calc(", " * 2);", ";margin:", ";}"], (0, _spacing.default)('m'), (0, _zIndex.default)('low'), boxShadow, function (_ref10) {
|
|
106
106
|
var theme = _ref10.theme,
|
|
107
107
|
backgroundColor = _ref10.backgroundColor;
|
|
108
108
|
return theme.color(backgroundColor);
|
|
@@ -62,8 +62,12 @@ var Signup = function Signup(_ref) {
|
|
|
62
62
|
setMoneyBuyCopy = _useState8[1];
|
|
63
63
|
|
|
64
64
|
(0, _react.useEffect)(function () {
|
|
65
|
-
var givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
66
|
-
|
|
65
|
+
var givingData = givingType === 'single' ? singleGiving : regularGiving; // Check the 2nd moneybuy exists before using it;
|
|
66
|
+
// 'philantrophy' carts have been set up to use a single moneybuy.
|
|
67
|
+
// See ENG-1685 for more details
|
|
68
|
+
|
|
69
|
+
var thisAmount = givingData.moneybuys[1] ? givingData.moneybuys[1].value : givingData.moneybuys[0].value;
|
|
70
|
+
setAmountDonate(parseFloat(thisAmount));
|
|
67
71
|
}, [givingType, singleGiving, regularGiving]);
|
|
68
72
|
(0, _react.useEffect)(function () {
|
|
69
73
|
var givingData = givingType === 'single' ? singleGiving : regularGiving;
|
package/docs/installation.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
CR-CL has a dependency of Styled-components.
|
|
4
4
|
|
|
5
5
|
#### Install the package
|
|
6
|
-
`yarn add @comicrelief/component-library`
|
|
6
|
+
`yarn add @comicrelief/component-library`
|
|
7
7
|
|
|
8
8
|
#### Wrap your app with the ThemeProvider and crTheme
|
|
9
|
-
`import { ThemeProvider,
|
|
9
|
+
`import { ThemeProvider, crTheme } from '@comicrelief/component-library';`
|
|
10
10
|
|
|
11
11
|
#### Import components
|
|
12
|
-
`import { HeroBanner } from '@
|
|
12
|
+
`import { HeroBanner } from '@comicrelief/component-library';`
|
package/package.json
CHANGED
|
@@ -11,11 +11,10 @@ const Container = styled.div`
|
|
|
11
11
|
position: relative;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
height: 100%;
|
|
14
|
-
width:
|
|
14
|
+
width: 100%;
|
|
15
15
|
background: ${({ theme, backgroundColor }) => theme.color(backgroundColor)};
|
|
16
16
|
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
17
17
|
flex-direction: row;
|
|
18
|
-
width: 100%;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
@media ${({ theme }) => theme.breakpoint('large')} {
|
|
@@ -26,14 +25,7 @@ const Container = styled.div`
|
|
|
26
25
|
const Image = styled.div`
|
|
27
26
|
height: auto;
|
|
28
27
|
margin: 0 -${spacing('m')} 0 ${spacing('m')};
|
|
29
|
-
@media ${({ theme }) => theme.breakpoint('small')} {
|
|
30
|
-
margin: 0;
|
|
31
|
-
${({ hasLink }) => !hasLink && `width: calc(50% - ${spacing('xl')})`};
|
|
32
|
-
}
|
|
33
28
|
|
|
34
|
-
@media ${({ theme }) => theme.breakpoint('large')} {
|
|
35
|
-
margin: 0 -${spacing('m')} 0 ${spacing('m')};
|
|
36
|
-
}
|
|
37
29
|
img {
|
|
38
30
|
border-radius: 1rem;
|
|
39
31
|
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.15);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# CardDs
|
|
2
|
+
## Image and CTA are clickable and links user through to full content
|
|
2
3
|
|
|
3
|
-
## Image and CTA are clickable and links user through to full conten
|
|
4
4
|
|
|
5
|
+
### CardDs: Image, Text & Link
|
|
5
6
|
```js
|
|
6
7
|
const data = require('../../../styleguide/data/data').default;
|
|
7
8
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -35,8 +36,8 @@ import { Internal } from '../../Atoms/Icons/index';
|
|
|
35
36
|
</div>;
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
### CardDs no Image with Link
|
|
39
39
|
|
|
40
|
+
### CardDs: Text & Link
|
|
40
41
|
```js
|
|
41
42
|
const data = require('../../../styleguide/data/data').default;
|
|
42
43
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -67,8 +68,7 @@ import { Download } from '../../Atoms/Icons/index';
|
|
|
67
68
|
</div>;
|
|
68
69
|
```
|
|
69
70
|
|
|
70
|
-
### CardDs
|
|
71
|
-
|
|
71
|
+
### CardDs: Text only
|
|
72
72
|
```js
|
|
73
73
|
const data = require('../../../styleguide/data/data').default;
|
|
74
74
|
import Text from '../../Atoms/Text/Text';
|
|
@@ -89,3 +89,35 @@ import Link from '../../Atoms/Link/Link';
|
|
|
89
89
|
</CardDs>
|
|
90
90
|
</div>;
|
|
91
91
|
```
|
|
92
|
+
|
|
93
|
+
### CardDs: Image & Text, No Link
|
|
94
|
+
```js
|
|
95
|
+
const data = require('../../../styleguide/data/data').default;
|
|
96
|
+
import Text from '../../Atoms/Text/Text';
|
|
97
|
+
import Link from '../../Atoms/Link/Link';
|
|
98
|
+
import { Internal } from '../../Atoms/Icons/index';
|
|
99
|
+
|
|
100
|
+
<div
|
|
101
|
+
style={{
|
|
102
|
+
display: 'flex',
|
|
103
|
+
padding: '2rem 0',
|
|
104
|
+
background: '#E1E2E3',
|
|
105
|
+
justifyContent: 'space-around'
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<CardDs
|
|
109
|
+
target="_blank"
|
|
110
|
+
imageLow={data.image}
|
|
111
|
+
images={data.images}
|
|
112
|
+
imageAltText="Happy man going to work"
|
|
113
|
+
backgroundColor="white"
|
|
114
|
+
height="auto"
|
|
115
|
+
icon={<Internal colour="white" />}
|
|
116
|
+
>
|
|
117
|
+
<Text tag="h3" color="purple" size="xl">
|
|
118
|
+
Title
|
|
119
|
+
</Text>
|
|
120
|
+
<Text tag="p">Text body copy description</Text>
|
|
121
|
+
</CardDs>
|
|
122
|
+
</div>;
|
|
123
|
+
```
|
|
@@ -71,7 +71,7 @@ exports[`renders correctly 1`] = `
|
|
|
71
71
|
-ms-flex-direction: column;
|
|
72
72
|
flex-direction: column;
|
|
73
73
|
height: 100%;
|
|
74
|
-
width:
|
|
74
|
+
width: 100%;
|
|
75
75
|
background: inherit;
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -134,7 +134,6 @@ exports[`renders correctly 1`] = `
|
|
|
134
134
|
-webkit-flex-direction: row;
|
|
135
135
|
-ms-flex-direction: row;
|
|
136
136
|
flex-direction: row;
|
|
137
|
-
width: 100%;
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
|
|
@@ -146,18 +145,6 @@ exports[`renders correctly 1`] = `
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
|
|
149
|
-
@media (min-width:740px) {
|
|
150
|
-
.c2 {
|
|
151
|
-
margin: 0;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@media (min-width:1440px) {
|
|
156
|
-
.c2 {
|
|
157
|
-
margin: 0 -1.5rem 0 1.5rem;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
148
|
@media (min-width:740px) {
|
|
162
149
|
.c1 {
|
|
163
150
|
width: calc(50% + 6rem);
|
|
@@ -40,7 +40,14 @@ const Signup = ({
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// Check the 2nd moneybuy exists before using it;
|
|
44
|
+
// 'philantrophy' carts have been set up to use a single moneybuy.
|
|
45
|
+
// See ENG-1685 for more details
|
|
46
|
+
const thisAmount = givingData.moneybuys[1]
|
|
47
|
+
? givingData.moneybuys[1].value
|
|
48
|
+
: givingData.moneybuys[0].value;
|
|
49
|
+
|
|
50
|
+
setAmountDonate(parseFloat(thisAmount));
|
|
44
51
|
}, [givingType, singleGiving, regularGiving]);
|
|
45
52
|
|
|
46
53
|
useEffect(() => {
|
package/styleguide.config.js
CHANGED
|
@@ -3,7 +3,7 @@ const path = require('path');
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
getComponentPathLine(componentPath) {
|
|
5
5
|
const name = path.basename(componentPath, '.js');
|
|
6
|
-
return `import { ${name} } from '@
|
|
6
|
+
return `import { ${name} } from '@comicrelief/component-library';`;
|
|
7
7
|
},
|
|
8
8
|
assetsDir: 'src/styleguide/assets/',
|
|
9
9
|
styleguideComponents: {
|