@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.
@@ -6,68 +6,75 @@ import { CampaignGroupsService } from '../../util/campaign-groups';
6
6
  export class BiggiveCampaignCard {
7
7
  constructor() {
8
8
  /**
9
- * @param {string} banner Full URL of a banner image.
9
+ * Full URL of a banner image.
10
10
  */
11
11
  this.banner = '';
12
12
  /**
13
- * @param {string} number (Ceiling of) whole number of days until campaign end.
13
+ * (Ceiling of) whole number of days until campaign end.
14
14
  */
15
15
  this.daysRemaining = null;
16
16
  /**
17
- * @param {number} totalFundsRaised Target for the campaign including matching but excluding any
18
- * tax relief, in major unit of currency e.g. pounds GBP.
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
- * @param {string} organisationName Display name of the charity or non-profit.
22
+ * Display name of the charity or non-profit.
23
23
  */
24
24
  this.organisationName = null;
25
25
  /**
26
- * @param {string} organisationName Display name of the charity's specific time-bound fundraising campaign.
26
+ * Display name of the charity's specific time-bound fundraising campaign.
27
27
  */
28
28
  this.campaignTitle = null;
29
29
  /**
30
- * @param {string} campaignType e.g. "Match Funded".
30
+ * e.g. "Match Funded".
31
31
  */
32
32
  this.campaignType = null;
33
33
  /**
34
- * @param {string} beneficiaries Pipe (|) -separated list of full category labels.
34
+ * Array of full beneficiary labels.
35
35
  */
36
- this.beneficiaries = '';
36
+ this.beneficiaries = [];
37
37
  /**
38
- * @param {string} categories Pipe (|) -separated list of full category labels.
38
+ * Array of full category labels.
39
39
  */
40
- this.categories = '';
40
+ this.categories = [];
41
41
  /**
42
- * @param {number} totalFundsRaised Match funds not yet used or reserved, in major unit of currency
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
- * @param {number} totalFundsRaised Total the campaign has raised so far including matching but excluding any
48
- * tax relief, in major unit of currency e.g. pounds GBP.
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
- * @param {string} callToActionUrl Full URL of a call to action.
51
+ * Full URL of a call to action.
53
52
  */
54
53
  this.callToActionUrl = null;
55
54
  /**
56
- * @param {string} callToActionLabel Text for the link to `callToActionUrl`.
55
+ * Text for the link to `callToActionUrl`.
57
56
  */
58
57
  this.callToActionLabel = null;
59
58
  }
60
59
  getBeneficiaryIcons() {
61
- return this.beneficiaries.length > 0 ? this.beneficiaries.split('|').map(beneficiary => CampaignGroupsService.getBeneficiaryIcon(beneficiary)) : [];
60
+ return this.beneficiaries.map(beneficiary => CampaignGroupsService.getBeneficiaryIcon(beneficiary));
62
61
  }
63
62
  getCategoryIcons() {
64
- return this.categories.length > 0 ? this.categories.split('|').map(category => CampaignGroupsService.getCategoryIcon(category)) : [];
63
+ return this.categories.map(category => CampaignGroupsService.getCategoryIcon(category));
65
64
  }
66
- formatCurrency(num) {
67
- if (!isNaN(num)) {
68
- return parseInt(num).toLocaleString();
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 num;
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.css"]
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
- "name": "param",
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
- "name": "param",
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
- "name": "param",
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
- "name": "param",
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
- "name": "param",
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
- "name": "param",
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": "string",
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
- "name": "param",
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
- "attribute": "beneficiaries",
276
- "reflect": false,
277
- "defaultValue": "''"
272
+ "defaultValue": "[]"
278
273
  },
279
274
  "categories": {
280
- "type": "string",
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
- "name": "param",
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
- "attribute": "categories",
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
- "name": "param",
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
- "name": "param",
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
- "name": "param",
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
- "name": "param",
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,
@@ -3,12 +3,7 @@
3
3
  }
4
4
 
5
5
  .grid {
6
- display: -webkit-box;
7
- display: -moz-box;
8
- display: -webkit-flex;
9
6
  display: flex;
10
- -webkit-flex-flow: row wrap;
11
7
  flex-flow: row wrap;
12
- -webkit-justify-content: space-between;
13
8
  justify-content: space-between;
14
- }
9
+ }
@@ -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'), "days-remaining": 50, target: 50000, "organisation-name": "Ardent Theatre Company", "campaign-type": "Match Funded", "campaign-title": "Strike! A play by Tracy Ryan", categories: "Arts/Culture/Heritage|Environment/Conservation|Health/Wellbeing", beneficiaries: "General Public/Humankind", "match-funds-remaining": 17424, "total-funds-raised": 15424, "call-to-action-url": "#", "call-to-action-label": "Donate" })))));
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}:host([column='1-5']){width:100%}:host([column='1-2']){width:calc(50% - (30px / 2))}:host([column='1-3']){width:calc(33.3% - (60px / 3))}:host([column='1-4']){width:calc(25% - (90px / 4))}:host([column='1-5']){width:calc(20% - (120px / 5))}.container{font-family:'Euclid Triangle', sans-serif;filter:drop-shadow(-1px 6px 3px rgba(0,0,0,0.25))}.sleeve{clip-path:polygon(\n 0% 0%, \n 0% 0%, \n 100% 0%, \n 100% 0%, \n 100% 100%, \n 100% 100%, \n 10% 100%, \n 0 90% \n )}.content{padding:15px;background-color:#FFFFFF}.campaign-type{margin-left:15px;width:0;height:0;border-style:inset;border-width:86.6px 50px 0 50px;border-color:#2AF135 transparent transparent transparent;float:left;transform:rotate(360deg)}.campaign-type span{display:block;text-align:center;top:-75px;left:-25px;position:relative;width:46.5px;height:46.5px;margin:0;color:#2C089B;font-size:12px}.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:-.125rem}";
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
- * @param {string} banner Full URL of a banner image.
329
+ * Full URL of a banner image.
330
330
  */
331
331
  this.banner = '';
332
332
  /**
333
- * @param {string} number (Ceiling of) whole number of days until campaign end.
333
+ * (Ceiling of) whole number of days until campaign end.
334
334
  */
335
335
  this.daysRemaining = null;
336
336
  /**
337
- * @param {number} totalFundsRaised Target for the campaign including matching but excluding any
338
- * tax relief, in major unit of currency e.g. pounds GBP.
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
- * @param {string} organisationName Display name of the charity or non-profit.
342
+ * Display name of the charity or non-profit.
343
343
  */
344
344
  this.organisationName = null;
345
345
  /**
346
- * @param {string} organisationName Display name of the charity's specific time-bound fundraising campaign.
346
+ * Display name of the charity's specific time-bound fundraising campaign.
347
347
  */
348
348
  this.campaignTitle = null;
349
349
  /**
350
- * @param {string} campaignType e.g. "Match Funded".
350
+ * e.g. "Match Funded".
351
351
  */
352
352
  this.campaignType = null;
353
353
  /**
354
- * @param {string} beneficiaries Pipe (|) -separated list of full category labels.
354
+ * Array of full beneficiary labels.
355
355
  */
356
- this.beneficiaries = '';
356
+ this.beneficiaries = [];
357
357
  /**
358
- * @param {string} categories Pipe (|) -separated list of full category labels.
358
+ * Array of full category labels.
359
359
  */
360
- this.categories = '';
360
+ this.categories = [];
361
361
  /**
362
- * @param {number} totalFundsRaised Match funds not yet used or reserved, in major unit of currency
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
- * @param {number} totalFundsRaised Total the campaign has raised so far including matching but excluding any
368
- * tax relief, in major unit of currency e.g. pounds GBP.
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
- * @param {string} callToActionUrl Full URL of a call to action.
371
+ * Full URL of a call to action.
373
372
  */
374
373
  this.callToActionUrl = null;
375
374
  /**
376
- * @param {string} callToActionLabel Text for the link to `callToActionUrl`.
375
+ * Text for the link to `callToActionUrl`.
377
376
  */
378
377
  this.callToActionLabel = null;
379
378
  }
380
379
  getBeneficiaryIcons() {
381
- return this.beneficiaries.length > 0 ? this.beneficiaries.split('|').map(beneficiary => CampaignGroupsService.getBeneficiaryIcon(beneficiary)) : [];
380
+ return this.beneficiaries.map(beneficiary => CampaignGroupsService.getBeneficiaryIcon(beneficiary));
382
381
  }
383
382
  getCategoryIcons() {
384
- return this.categories.length > 0 ? this.categories.split('|').map(category => CampaignGroupsService.getCategoryIcon(category)) : [];
383
+ return this.categories.map(category => CampaignGroupsService.getCategoryIcon(category));
385
384
  }
386
- formatCurrency(num) {
387
- if (!isNaN(num)) {
388
- return parseInt(num).toLocaleString();
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 num;
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" }, "\u00A3", this.formatCurrency(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" }, "\u00A3", this.formatCurrency(this.matchFundsRemaining))), h("div", { class: "meta-item" }, h("span", { class: "label" }, "Total", h("br", null), "Funds Received"), h("span", { class: "text" }, "\u00A3", this.formatCurrency(this.totalFundsRaised)))), h("div", { class: "button-wrap" }, h("a", { href: this.callToActionUrl, class: "call-to-action" }, this.callToActionLabel))))));
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": [1],
404
- "categories": [1],
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:-webkit-box;display:-moz-box;display:-webkit-flex;display:flex;-webkit-flex-flow:row wrap;flex-flow:row wrap;-webkit-justify-content:space-between;justify-content:space-between}";
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'), "days-remaining": 50, target: 50000, "organisation-name": "Ardent Theatre Company", "campaign-type": "Match Funded", "campaign-title": "Strike! A play by Tracy Ryan", categories: "Arts/Culture/Heritage|Environment/Conservation|Health/Wellbeing", beneficiaries: "General Public/Humankind", "match-funds-remaining": 17424, "total-funds-raised": 15424, "call-to-action-url": "#", "call-to-action-label": "Donate" })))));
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"]);