@biggive/components 0.0.5 → 0.0.8
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/dist/biggive/biggive.esm.js +1 -1
- package/dist/biggive/{p-e6a690fb.entry.js → p-59970be1.entry.js} +2 -2
- package/dist/cjs/biggive-campaign-card_3.cjs.entry.js +34 -27
- package/dist/cjs/biggive.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/biggive-campaign-card/biggive-campaign-card.css +11 -44
- package/dist/collection/components/biggive-campaign-card/biggive-campaign-card.js +83 -105
- package/dist/collection/components/biggive-grid/biggive-grid.css +1 -6
- package/dist/collection/components/demo-campaign-cards/demo-campaign-cards.js +1 -1
- package/dist/components/biggive-campaign-card2.js +35 -27
- package/dist/components/biggive-grid2.js +1 -1
- package/dist/components/demo-campaign-cards.js +1 -1
- package/dist/esm/biggive-campaign-card_3.entry.js +34 -27
- package/dist/esm/biggive.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/biggive-campaign-card/biggive-campaign-card.d.ts +23 -17
- package/dist/types/components.d.ts +36 -28
- package/package.json +5 -4
- package/readme.md +3 -1
|
@@ -6,68 +6,75 @@ import { CampaignGroupsService } from '../../util/campaign-groups';
|
|
|
6
6
|
export class BiggiveCampaignCard {
|
|
7
7
|
constructor() {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Full URL of a banner image.
|
|
10
10
|
*/
|
|
11
11
|
this.banner = '';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* (Ceiling of) whole number of days until campaign end.
|
|
14
14
|
*/
|
|
15
15
|
this.daysRemaining = null;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Target for the campaign including matching but excluding any
|
|
18
|
+
* tax relief, in major unit of currency e.g. pounds GBP.
|
|
19
19
|
*/
|
|
20
20
|
this.target = null;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Display name of the charity or non-profit.
|
|
23
23
|
*/
|
|
24
24
|
this.organisationName = null;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Display name of the charity's specific time-bound fundraising campaign.
|
|
27
27
|
*/
|
|
28
28
|
this.campaignTitle = null;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* e.g. "Match Funded".
|
|
31
31
|
*/
|
|
32
32
|
this.campaignType = null;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Array of full beneficiary labels.
|
|
35
35
|
*/
|
|
36
|
-
this.beneficiaries =
|
|
36
|
+
this.beneficiaries = [];
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Array of full category labels.
|
|
39
39
|
*/
|
|
40
|
-
this.categories =
|
|
40
|
+
this.categories = [];
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
* e.g. pounds GBP.
|
|
42
|
+
* Match funds not yet used or reserved, in major unit of currency e.g. pounds GBP.
|
|
44
43
|
*/
|
|
45
44
|
this.matchFundsRemaining = null;
|
|
46
45
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* Total the campaign has raised so far including matching but excluding any
|
|
47
|
+
* tax relief, in major unit of currency e.g. pounds GBP.
|
|
49
48
|
*/
|
|
50
49
|
this.totalFundsRaised = null;
|
|
51
50
|
/**
|
|
52
|
-
*
|
|
51
|
+
* Full URL of a call to action.
|
|
53
52
|
*/
|
|
54
53
|
this.callToActionUrl = null;
|
|
55
54
|
/**
|
|
56
|
-
*
|
|
55
|
+
* Text for the link to `callToActionUrl`.
|
|
57
56
|
*/
|
|
58
57
|
this.callToActionLabel = null;
|
|
59
58
|
}
|
|
60
59
|
getBeneficiaryIcons() {
|
|
61
|
-
return this.beneficiaries.
|
|
60
|
+
return this.beneficiaries.map(beneficiary => CampaignGroupsService.getBeneficiaryIcon(beneficiary));
|
|
62
61
|
}
|
|
63
62
|
getCategoryIcons() {
|
|
64
|
-
return this.categories.
|
|
63
|
+
return this.categories.map(category => CampaignGroupsService.getCategoryIcon(category));
|
|
65
64
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/**
|
|
66
|
+
* @returns Whole large currency units (e.g. pounds) formatted with symbol.
|
|
67
|
+
*/
|
|
68
|
+
formatCurrency(currencyCode, amount) {
|
|
69
|
+
if (amount === null || isNaN(amount)) {
|
|
70
|
+
return '–';
|
|
69
71
|
}
|
|
70
|
-
return
|
|
72
|
+
return Intl.NumberFormat('en-GB', {
|
|
73
|
+
style: 'currency',
|
|
74
|
+
currency: currencyCode,
|
|
75
|
+
currencyDisplay: 'symbol',
|
|
76
|
+
maximumFractionDigits: 0,
|
|
77
|
+
}).format(amount);
|
|
71
78
|
}
|
|
72
79
|
render() {
|
|
73
80
|
return (h("div", { class: "container" },
|
|
@@ -85,9 +92,7 @@ export class BiggiveCampaignCard {
|
|
|
85
92
|
h("div", { class: "meta-item" },
|
|
86
93
|
h("span", { class: "label" }, "Target:"),
|
|
87
94
|
" ",
|
|
88
|
-
h("span", { class: "text" },
|
|
89
|
-
"\u00A3",
|
|
90
|
-
this.formatCurrency(this.target)))),
|
|
95
|
+
h("span", { class: "text" }, this.formatCurrency(this.currencyCode, this.target)))),
|
|
91
96
|
h("header", null,
|
|
92
97
|
h("div", { class: "slug" }, this.organisationName),
|
|
93
98
|
h("h3", null, this.campaignTitle)),
|
|
@@ -106,24 +111,20 @@ export class BiggiveCampaignCard {
|
|
|
106
111
|
"Match",
|
|
107
112
|
h("br", null),
|
|
108
113
|
"Funds Remaining"),
|
|
109
|
-
h("span", { class: "text" },
|
|
110
|
-
"\u00A3",
|
|
111
|
-
this.formatCurrency(this.matchFundsRemaining))),
|
|
114
|
+
h("span", { class: "text" }, this.formatCurrency(this.currencyCode, this.matchFundsRemaining))),
|
|
112
115
|
h("div", { class: "meta-item" },
|
|
113
116
|
h("span", { class: "label" },
|
|
114
117
|
"Total",
|
|
115
118
|
h("br", null),
|
|
116
119
|
"Funds Received"),
|
|
117
|
-
h("span", { class: "text" },
|
|
118
|
-
"\u00A3",
|
|
119
|
-
this.formatCurrency(this.totalFundsRaised)))),
|
|
120
|
+
h("span", { class: "text" }, this.formatCurrency(this.currencyCode, this.totalFundsRaised)))),
|
|
120
121
|
h("div", { class: "button-wrap" },
|
|
121
122
|
h("a", { href: this.callToActionUrl, class: "call-to-action" }, this.callToActionLabel))))));
|
|
122
123
|
}
|
|
123
124
|
static get is() { return "biggive-campaign-card"; }
|
|
124
125
|
static get encapsulation() { return "shadow"; }
|
|
125
126
|
static get originalStyleUrls() { return {
|
|
126
|
-
"$": ["biggive-campaign-card.
|
|
127
|
+
"$": ["biggive-campaign-card.scss"]
|
|
127
128
|
}; }
|
|
128
129
|
static get styleUrls() { return {
|
|
129
130
|
"$": ["biggive-campaign-card.css"]
|
|
@@ -140,11 +141,8 @@ export class BiggiveCampaignCard {
|
|
|
140
141
|
"required": false,
|
|
141
142
|
"optional": false,
|
|
142
143
|
"docs": {
|
|
143
|
-
"tags": [
|
|
144
|
-
|
|
145
|
-
"text": "banner Full URL of a banner image."
|
|
146
|
-
}],
|
|
147
|
-
"text": ""
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": "Full URL of a banner image."
|
|
148
146
|
},
|
|
149
147
|
"attribute": "banner",
|
|
150
148
|
"reflect": false,
|
|
@@ -161,16 +159,30 @@ export class BiggiveCampaignCard {
|
|
|
161
159
|
"required": false,
|
|
162
160
|
"optional": false,
|
|
163
161
|
"docs": {
|
|
164
|
-
"tags": [
|
|
165
|
-
|
|
166
|
-
"text": "number (Ceiling of) whole number of days until campaign end."
|
|
167
|
-
}],
|
|
168
|
-
"text": ""
|
|
162
|
+
"tags": [],
|
|
163
|
+
"text": "(Ceiling of) whole number of days until campaign end."
|
|
169
164
|
},
|
|
170
165
|
"attribute": "days-remaining",
|
|
171
166
|
"reflect": false,
|
|
172
167
|
"defaultValue": "null"
|
|
173
168
|
},
|
|
169
|
+
"currencyCode": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "string",
|
|
174
|
+
"resolved": "string",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "e.g. 'GBP'."
|
|
182
|
+
},
|
|
183
|
+
"attribute": "currency-code",
|
|
184
|
+
"reflect": false
|
|
185
|
+
},
|
|
174
186
|
"target": {
|
|
175
187
|
"type": "number",
|
|
176
188
|
"mutable": false,
|
|
@@ -182,11 +194,8 @@ export class BiggiveCampaignCard {
|
|
|
182
194
|
"required": false,
|
|
183
195
|
"optional": false,
|
|
184
196
|
"docs": {
|
|
185
|
-
"tags": [
|
|
186
|
-
|
|
187
|
-
"text": "totalFundsRaised Target for the campaign including matching but excluding any\n tax relief, in major unit of currency e.g. pounds GBP."
|
|
188
|
-
}],
|
|
189
|
-
"text": ""
|
|
197
|
+
"tags": [],
|
|
198
|
+
"text": "Target for the campaign including matching but excluding any\ntax relief, in major unit of currency e.g. pounds GBP."
|
|
190
199
|
},
|
|
191
200
|
"attribute": "target",
|
|
192
201
|
"reflect": false,
|
|
@@ -203,11 +212,8 @@ export class BiggiveCampaignCard {
|
|
|
203
212
|
"required": false,
|
|
204
213
|
"optional": false,
|
|
205
214
|
"docs": {
|
|
206
|
-
"tags": [
|
|
207
|
-
|
|
208
|
-
"text": "organisationName Display name of the charity or non-profit."
|
|
209
|
-
}],
|
|
210
|
-
"text": ""
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": "Display name of the charity or non-profit."
|
|
211
217
|
},
|
|
212
218
|
"attribute": "organisation-name",
|
|
213
219
|
"reflect": false,
|
|
@@ -224,11 +230,8 @@ export class BiggiveCampaignCard {
|
|
|
224
230
|
"required": false,
|
|
225
231
|
"optional": false,
|
|
226
232
|
"docs": {
|
|
227
|
-
"tags": [
|
|
228
|
-
|
|
229
|
-
"text": "organisationName Display name of the charity's specific time-bound fundraising campaign."
|
|
230
|
-
}],
|
|
231
|
-
"text": ""
|
|
233
|
+
"tags": [],
|
|
234
|
+
"text": "Display name of the charity's specific time-bound fundraising campaign."
|
|
232
235
|
},
|
|
233
236
|
"attribute": "campaign-title",
|
|
234
237
|
"reflect": false,
|
|
@@ -245,57 +248,44 @@ export class BiggiveCampaignCard {
|
|
|
245
248
|
"required": false,
|
|
246
249
|
"optional": false,
|
|
247
250
|
"docs": {
|
|
248
|
-
"tags": [
|
|
249
|
-
|
|
250
|
-
"text": "campaignType e.g. \"Match Funded\"."
|
|
251
|
-
}],
|
|
252
|
-
"text": ""
|
|
251
|
+
"tags": [],
|
|
252
|
+
"text": "e.g. \"Match Funded\"."
|
|
253
253
|
},
|
|
254
254
|
"attribute": "campaign-type",
|
|
255
255
|
"reflect": false,
|
|
256
256
|
"defaultValue": "null"
|
|
257
257
|
},
|
|
258
258
|
"beneficiaries": {
|
|
259
|
-
"type": "
|
|
259
|
+
"type": "unknown",
|
|
260
260
|
"mutable": false,
|
|
261
261
|
"complexType": {
|
|
262
|
-
"original": "string",
|
|
263
|
-
"resolved": "string",
|
|
262
|
+
"original": "string[]",
|
|
263
|
+
"resolved": "string[]",
|
|
264
264
|
"references": {}
|
|
265
265
|
},
|
|
266
266
|
"required": false,
|
|
267
267
|
"optional": false,
|
|
268
268
|
"docs": {
|
|
269
|
-
"tags": [
|
|
270
|
-
|
|
271
|
-
"text": "beneficiaries Pipe (|) -separated list of full category labels."
|
|
272
|
-
}],
|
|
273
|
-
"text": ""
|
|
269
|
+
"tags": [],
|
|
270
|
+
"text": "Array of full beneficiary labels."
|
|
274
271
|
},
|
|
275
|
-
"
|
|
276
|
-
"reflect": false,
|
|
277
|
-
"defaultValue": "''"
|
|
272
|
+
"defaultValue": "[]"
|
|
278
273
|
},
|
|
279
274
|
"categories": {
|
|
280
|
-
"type": "
|
|
275
|
+
"type": "unknown",
|
|
281
276
|
"mutable": false,
|
|
282
277
|
"complexType": {
|
|
283
|
-
"original": "string",
|
|
284
|
-
"resolved": "string",
|
|
278
|
+
"original": "string[]",
|
|
279
|
+
"resolved": "string[]",
|
|
285
280
|
"references": {}
|
|
286
281
|
},
|
|
287
282
|
"required": false,
|
|
288
283
|
"optional": false,
|
|
289
284
|
"docs": {
|
|
290
|
-
"tags": [
|
|
291
|
-
|
|
292
|
-
"text": "categories Pipe (|) -separated list of full category labels."
|
|
293
|
-
}],
|
|
294
|
-
"text": ""
|
|
285
|
+
"tags": [],
|
|
286
|
+
"text": "Array of full category labels."
|
|
295
287
|
},
|
|
296
|
-
"
|
|
297
|
-
"reflect": false,
|
|
298
|
-
"defaultValue": "''"
|
|
288
|
+
"defaultValue": "[]"
|
|
299
289
|
},
|
|
300
290
|
"matchFundsRemaining": {
|
|
301
291
|
"type": "number",
|
|
@@ -308,11 +298,8 @@ export class BiggiveCampaignCard {
|
|
|
308
298
|
"required": false,
|
|
309
299
|
"optional": false,
|
|
310
300
|
"docs": {
|
|
311
|
-
"tags": [
|
|
312
|
-
|
|
313
|
-
"text": "totalFundsRaised Match funds not yet used or reserved, in major unit of currency\n e.g. pounds GBP."
|
|
314
|
-
}],
|
|
315
|
-
"text": ""
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "Match funds not yet used or reserved, in major unit of currency e.g. pounds GBP."
|
|
316
303
|
},
|
|
317
304
|
"attribute": "match-funds-remaining",
|
|
318
305
|
"reflect": false,
|
|
@@ -329,11 +316,8 @@ export class BiggiveCampaignCard {
|
|
|
329
316
|
"required": false,
|
|
330
317
|
"optional": false,
|
|
331
318
|
"docs": {
|
|
332
|
-
"tags": [
|
|
333
|
-
|
|
334
|
-
"text": "totalFundsRaised Total the campaign has raised so far including matching but excluding any\ntax relief, in major unit of currency e.g. pounds GBP."
|
|
335
|
-
}],
|
|
336
|
-
"text": ""
|
|
319
|
+
"tags": [],
|
|
320
|
+
"text": "Total the campaign has raised so far including matching but excluding any\ntax relief, in major unit of currency e.g. pounds GBP."
|
|
337
321
|
},
|
|
338
322
|
"attribute": "total-funds-raised",
|
|
339
323
|
"reflect": false,
|
|
@@ -350,11 +334,8 @@ export class BiggiveCampaignCard {
|
|
|
350
334
|
"required": false,
|
|
351
335
|
"optional": false,
|
|
352
336
|
"docs": {
|
|
353
|
-
"tags": [
|
|
354
|
-
|
|
355
|
-
"text": "callToActionUrl Full URL of a call to action."
|
|
356
|
-
}],
|
|
357
|
-
"text": ""
|
|
337
|
+
"tags": [],
|
|
338
|
+
"text": "Full URL of a call to action."
|
|
358
339
|
},
|
|
359
340
|
"attribute": "call-to-action-url",
|
|
360
341
|
"reflect": false,
|
|
@@ -371,11 +352,8 @@ export class BiggiveCampaignCard {
|
|
|
371
352
|
"required": false,
|
|
372
353
|
"optional": false,
|
|
373
354
|
"docs": {
|
|
374
|
-
"tags": [
|
|
375
|
-
|
|
376
|
-
"text": "callToActionLabel Text for the link to `callToActionUrl`."
|
|
377
|
-
}],
|
|
378
|
-
"text": ""
|
|
355
|
+
"tags": [],
|
|
356
|
+
"text": "Text for the link to `callToActionUrl`."
|
|
379
357
|
},
|
|
380
358
|
"attribute": "call-to-action-label",
|
|
381
359
|
"reflect": false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, getAssetPath, h } from '@stencil/core';
|
|
2
2
|
export class DemoCampaignCards {
|
|
3
3
|
render() {
|
|
4
|
-
return (h("biggive-grid", null, [...Array(12)].map(() => (h("biggive-campaign-card", { banner: getAssetPath('/assets/images/banner.png'),
|
|
4
|
+
return (h("biggive-grid", null, [...Array(12)].map(() => (h("biggive-campaign-card", { banner: getAssetPath('/assets/images/banner.png'), daysRemaining: 50, currencyCode: "GBP", target: 50000, organisationName: "Ardent Theatre Company", campaignType: "Match Funded", campaignTitle: "Strike! A play by Tracy Ryan", categories: ['Arts/Culture/Heritage', 'Environment/Conservation', 'Health/Wellbeing'], beneficiaries: ['General Public/Humankind'], matchFundsRemaining: 17424, totalFundsRaised: 15424, callToActionUrl: "#", callToActionLabel: "Donate" })))));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "demo-campaign-cards"; }
|
|
7
7
|
static get encapsulation() { return "shadow"; }
|
|
@@ -318,7 +318,7 @@ class CampaignGroupsService {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
const biggiveCampaignCardCss = ":host{display:block;margin-bottom:30px}
|
|
321
|
+
const biggiveCampaignCardCss = ":host{display:block;margin-bottom:30px}.container{font-family:\"Euclid Triangle\", sans-serif;filter:drop-shadow(-1px 6px 3px rgba(0, 0, 0, 0.25))}.sleeve{clip-path:polygon(0% 0%, 0% 0%, 100% 0%, 100% 0%, 100% 100%, 100% 100%, 10% 100%, 0 90%)}.content{padding:15px;background-color:#FFFFFF}.campaign-type{margin-left:15px;width:0;height:0;border-style:inset;border-width:85px 45px 0 45px;border-color:#2AF135 transparent transparent transparent;float:left;transform:rotate(360deg)}.campaign-type span{display:block;text-align:center;top:-85px;left:-25px;position:relative;width:45px;height:45px;margin:0;color:#2C089B;font-size:0.9rem}.banner{padding-bottom:30%;background-repeat:no-repeat;background-position:center center;background-size:cover}.banner img{display:none}.meta-wrap.style-1{display:flex;font-size:16px;line-height:20px;margin-bottom:20px}.meta-wrap.style-1 .meta-item{width:50%}.meta-wrap.style-1 .meta-item .label{font-weight:bold}.meta-wrap.style-1 .meta-item .text{color:#2C089B}header{margin-bottom:20px}header .slug{text-transform:uppercase;font-size:12px;line-height:14px}header h3{margin:0;padding:0;font-size:24px;line-height:28px}.meta-wrap.style-2{display:flex;font-size:12px;line-height:14px;margin-bottom:40px}.meta-wrap.style-2 .meta-item{width:50%}.meta-wrap.style-2 .meta-item .label{font-weight:bold;display:block;margin-bottom:10px}.meta-wrap.style-2 .meta-item .text{display:block;font-size:16px;line-height:18px}.meta-wrap.style-2 .meta-item .text i{margin-right:10px}.meta-wrap.style-3{display:flex;font-size:16px;line-height:20px;margin-bottom:20px}.meta-wrap.style-3 .meta-item{margin-right:60px}.meta-wrap.style-3 .meta-item .label{font-weight:bold;display:block;font-size:12px;line-height:14px;margin-bottom:10px}.meta-wrap.style-3 .meta-item .text{display:block;font-size:36px;line-height:40px;font-weight:bold}.meta-wrap.style-3 .meta-item:last-child .text{color:#2C089B}.button-wrap{text-align:right}.button-wrap a{display:inline-block;padding:15px 30px;color:#FFFFFF;background-color:#2C089B;cursor:pointer;text-transform:uppercase;font-size:12px;text-decoration:none}.icon{height:1rem;width:2rem;vertical-align:-0.125rem}";
|
|
322
322
|
|
|
323
323
|
const BiggiveCampaignCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
324
324
|
constructor() {
|
|
@@ -326,82 +326,90 @@ const BiggiveCampaignCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
|
|
|
326
326
|
this.__registerHost();
|
|
327
327
|
this.__attachShadow();
|
|
328
328
|
/**
|
|
329
|
-
*
|
|
329
|
+
* Full URL of a banner image.
|
|
330
330
|
*/
|
|
331
331
|
this.banner = '';
|
|
332
332
|
/**
|
|
333
|
-
*
|
|
333
|
+
* (Ceiling of) whole number of days until campaign end.
|
|
334
334
|
*/
|
|
335
335
|
this.daysRemaining = null;
|
|
336
336
|
/**
|
|
337
|
-
*
|
|
338
|
-
*
|
|
337
|
+
* Target for the campaign including matching but excluding any
|
|
338
|
+
* tax relief, in major unit of currency e.g. pounds GBP.
|
|
339
339
|
*/
|
|
340
340
|
this.target = null;
|
|
341
341
|
/**
|
|
342
|
-
*
|
|
342
|
+
* Display name of the charity or non-profit.
|
|
343
343
|
*/
|
|
344
344
|
this.organisationName = null;
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
346
|
+
* Display name of the charity's specific time-bound fundraising campaign.
|
|
347
347
|
*/
|
|
348
348
|
this.campaignTitle = null;
|
|
349
349
|
/**
|
|
350
|
-
*
|
|
350
|
+
* e.g. "Match Funded".
|
|
351
351
|
*/
|
|
352
352
|
this.campaignType = null;
|
|
353
353
|
/**
|
|
354
|
-
*
|
|
354
|
+
* Array of full beneficiary labels.
|
|
355
355
|
*/
|
|
356
|
-
this.beneficiaries =
|
|
356
|
+
this.beneficiaries = [];
|
|
357
357
|
/**
|
|
358
|
-
*
|
|
358
|
+
* Array of full category labels.
|
|
359
359
|
*/
|
|
360
|
-
this.categories =
|
|
360
|
+
this.categories = [];
|
|
361
361
|
/**
|
|
362
|
-
*
|
|
363
|
-
* e.g. pounds GBP.
|
|
362
|
+
* Match funds not yet used or reserved, in major unit of currency e.g. pounds GBP.
|
|
364
363
|
*/
|
|
365
364
|
this.matchFundsRemaining = null;
|
|
366
365
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
366
|
+
* Total the campaign has raised so far including matching but excluding any
|
|
367
|
+
* tax relief, in major unit of currency e.g. pounds GBP.
|
|
369
368
|
*/
|
|
370
369
|
this.totalFundsRaised = null;
|
|
371
370
|
/**
|
|
372
|
-
*
|
|
371
|
+
* Full URL of a call to action.
|
|
373
372
|
*/
|
|
374
373
|
this.callToActionUrl = null;
|
|
375
374
|
/**
|
|
376
|
-
*
|
|
375
|
+
* Text for the link to `callToActionUrl`.
|
|
377
376
|
*/
|
|
378
377
|
this.callToActionLabel = null;
|
|
379
378
|
}
|
|
380
379
|
getBeneficiaryIcons() {
|
|
381
|
-
return this.beneficiaries.
|
|
380
|
+
return this.beneficiaries.map(beneficiary => CampaignGroupsService.getBeneficiaryIcon(beneficiary));
|
|
382
381
|
}
|
|
383
382
|
getCategoryIcons() {
|
|
384
|
-
return this.categories.
|
|
383
|
+
return this.categories.map(category => CampaignGroupsService.getCategoryIcon(category));
|
|
385
384
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
/**
|
|
386
|
+
* @returns Whole large currency units (e.g. pounds) formatted with symbol.
|
|
387
|
+
*/
|
|
388
|
+
formatCurrency(currencyCode, amount) {
|
|
389
|
+
if (amount === null || isNaN(amount)) {
|
|
390
|
+
return '–';
|
|
389
391
|
}
|
|
390
|
-
return
|
|
392
|
+
return Intl.NumberFormat('en-GB', {
|
|
393
|
+
style: 'currency',
|
|
394
|
+
currency: currencyCode,
|
|
395
|
+
currencyDisplay: 'symbol',
|
|
396
|
+
maximumFractionDigits: 0,
|
|
397
|
+
}).format(amount);
|
|
391
398
|
}
|
|
392
399
|
render() {
|
|
393
|
-
return (h("div", { class: "container" }, h("div", { class: "sleeve" }, h("div", { class: "campaign-type" }, h("span", null, this.campaignType)), this.banner.length > 0 ? (h("div", { class: "image-wrap banner", style: { 'background-image': 'url(' + this.banner + ')' } }, h("img", { src: this.banner, class: "banner" }))) : null, h("div", { class: "content" }, h("div", { class: "meta-wrap style-1" }, h("div", { class: "meta-item" }, h("span", { class: "label" }, "Days Remaining:"), " ", h("span", { class: "text" }, this.daysRemaining)), h("div", { class: "meta-item" }, h("span", { class: "label" }, "Target:"), " ", h("span", { class: "text" },
|
|
400
|
+
return (h("div", { class: "container" }, h("div", { class: "sleeve" }, h("div", { class: "campaign-type" }, h("span", null, this.campaignType)), this.banner.length > 0 ? (h("div", { class: "image-wrap banner", style: { 'background-image': 'url(' + this.banner + ')' } }, h("img", { src: this.banner, class: "banner" }))) : null, h("div", { class: "content" }, h("div", { class: "meta-wrap style-1" }, h("div", { class: "meta-item" }, h("span", { class: "label" }, "Days Remaining:"), " ", h("span", { class: "text" }, this.daysRemaining)), h("div", { class: "meta-item" }, h("span", { class: "label" }, "Target:"), " ", h("span", { class: "text" }, this.formatCurrency(this.currencyCode, this.target)))), h("header", null, h("div", { class: "slug" }, this.organisationName), h("h3", null, this.campaignTitle)), h("div", { class: "meta-wrap style-2" }, h("div", { class: "meta-item" }, h("span", { class: "label" }, "Categories"), h("span", { class: "text" }, this.getCategoryIcons().map((iconDefinition) => (h("svg", { width: "512", height: "512", xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: iconDefinition.icon[4].toString() })))))), h("div", { class: "meta-item" }, h("span", { class: "label" }, "Helping"), h("span", { class: "text" }, this.getBeneficiaryIcons().map(iconDefinition => (h("svg", { width: "512", height: "512", xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: iconDefinition.icon[4].toString() }))))))), h("div", { class: "meta-wrap style-3" }, h("div", { class: "meta-item" }, h("span", { class: "label" }, "Match", h("br", null), "Funds Remaining"), h("span", { class: "text" }, this.formatCurrency(this.currencyCode, this.matchFundsRemaining))), h("div", { class: "meta-item" }, h("span", { class: "label" }, "Total", h("br", null), "Funds Received"), h("span", { class: "text" }, this.formatCurrency(this.currencyCode, this.totalFundsRaised)))), h("div", { class: "button-wrap" }, h("a", { href: this.callToActionUrl, class: "call-to-action" }, this.callToActionLabel))))));
|
|
394
401
|
}
|
|
395
402
|
static get style() { return biggiveCampaignCardCss; }
|
|
396
403
|
}, [1, "biggive-campaign-card", {
|
|
397
404
|
"banner": [1],
|
|
398
405
|
"daysRemaining": [2, "days-remaining"],
|
|
406
|
+
"currencyCode": [1, "currency-code"],
|
|
399
407
|
"target": [2],
|
|
400
408
|
"organisationName": [1, "organisation-name"],
|
|
401
409
|
"campaignTitle": [1, "campaign-title"],
|
|
402
410
|
"campaignType": [1, "campaign-type"],
|
|
403
|
-
"beneficiaries": [
|
|
404
|
-
"categories": [
|
|
411
|
+
"beneficiaries": [16],
|
|
412
|
+
"categories": [16],
|
|
405
413
|
"matchFundsRemaining": [2, "match-funds-remaining"],
|
|
406
414
|
"totalFundsRaised": [2, "total-funds-raised"],
|
|
407
415
|
"callToActionUrl": [1, "call-to-action-url"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const biggiveGridCss = ":host{display:block}.grid{display
|
|
3
|
+
const biggiveGridCss = ":host{display:block}.grid{display:flex;flex-flow:row wrap;justify-content:space-between}";
|
|
4
4
|
|
|
5
5
|
const BiggiveGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -11,7 +11,7 @@ const DemoCampaignCards$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
|
|
|
11
11
|
this.__attachShadow();
|
|
12
12
|
}
|
|
13
13
|
render() {
|
|
14
|
-
return (h("biggive-grid", null, [...Array(12)].map(() => (h("biggive-campaign-card", { banner: getAssetPath('/assets/images/banner.png'),
|
|
14
|
+
return (h("biggive-grid", null, [...Array(12)].map(() => (h("biggive-campaign-card", { banner: getAssetPath('/assets/images/banner.png'), daysRemaining: 50, currencyCode: "GBP", target: 50000, organisationName: "Ardent Theatre Company", campaignType: "Match Funded", campaignTitle: "Strike! A play by Tracy Ryan", categories: ['Arts/Culture/Heritage', 'Environment/Conservation', 'Health/Wellbeing'], beneficiaries: ['General Public/Humankind'], matchFundsRemaining: 17424, totalFundsRaised: 15424, callToActionUrl: "#", callToActionLabel: "Donate" })))));
|
|
15
15
|
}
|
|
16
16
|
static get style() { return demoCampaignCardsCss; }
|
|
17
17
|
}, [1, "demo-campaign-cards"]);
|