@kiva/kv-components 3.94.0 → 3.95.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.95.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.95.0...@kiva/kv-components@3.95.1) (2024-08-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * props usage removed reactivity ([6795042](https://github.com/kiva/kv-ui-elements/commit/6795042bfcc11e133781e2591eaee4035cfd7d63))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.95.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.94.0...@kiva/kv-components@3.95.0) (2024-08-28)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * add story for long borrower name ([da58fc9](https://github.com/kiva/kv-ui-elements/commit/da58fc9a078626577370eea41a0d9336edc2c74e))
23
+ * allow new card to be pull width ([59488dc](https://github.com/kiva/kv-ui-elements/commit/59488dc7e9550d8df38f73fe0b859844e65c6576))
24
+ * fully funded card ([17a9156](https://github.com/kiva/kv-ui-elements/commit/17a9156fc8003f2a19feb030cfe1e1ba369222dc))
25
+ * general new loan card styling tweaks ([dac3bb1](https://github.com/kiva/kv-ui-elements/commit/dac3bb14d62c97b04e7979e0c512edc4c90634c8))
26
+ * hide country for US loans ([5353e0f](https://github.com/kiva/kv-ui-elements/commit/5353e0f9b1678d013becf7775bb4c408cf72887a))
27
+ * one more small styling change ([042da40](https://github.com/kiva/kv-ui-elements/commit/042da402e089805260f4e465c8d237baf6bfe642))
28
+
29
+
30
+ ### Features
31
+
32
+ * add emojis and colors to loan tags ([8d002c2](https://github.com/kiva/kv-ui-elements/commit/8d002c25a243c305fae5113305a604c2f34746e4))
33
+
34
+
35
+
36
+
37
+
6
38
  # [3.94.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.93.0...@kiva/kv-components@3.94.0) (2024-08-23)
7
39
 
8
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.94.0",
3
+ "version": "3.95.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -84,5 +84,5 @@
84
84
  "optional": true
85
85
  }
86
86
  },
87
- "gitHead": "4d6b8d16d7fe0e5b3904b87a82484e28325cd496"
87
+ "gitHead": "731d35dd8d4d09b1688ce93fad36c6fe993b88e6"
88
88
  }
package/utils/loanCard.js CHANGED
@@ -13,7 +13,7 @@ const REFUGEE_KEY = 'REFUGEES/DISPLACED';
13
13
 
14
14
  const findCalloutData = (tags, tagName) => tags?.find((t) => t.name.replace('#', '').toUpperCase() === tagName.toUpperCase()) ?? {}; // eslint-disable-line max-len
15
15
 
16
- export function loanCardComputedProperties(props) {
16
+ export function loanCardComputedProperties(props, hideUnitedStatesText = false) {
17
17
  const {
18
18
  externalLinks,
19
19
  customLoanDetails,
@@ -49,7 +49,9 @@ export function loanCardComputedProperties(props) {
49
49
 
50
50
  const formattedLocation = computed(() => {
51
51
  if (distributionModel.value === 'direct') {
52
- return `${city.value}, ${state.value}, ${countryName.value}`;
52
+ const countryText = hideUnitedStatesText && countryName.value.toLowerCase() === 'united states'
53
+ ? '' : `, ${countryName.value}`;
54
+ return `${city.value}, ${state.value}${countryText}`;
53
55
  }
54
56
  if (countryName.value === 'Puerto Rico') {
55
57
  return `${city.value}, PR`;
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div
3
- class="tw-flex tw-flex-col tw-bg-white tw-rounded tw-w-full tw-pb-1"
3
+ class="tw-flex tw-flex-col tw-bg-white tw-rounded tw-w-full tw-pb-2"
4
4
  :class="{ 'tw-pointer-events-none' : isLoading }"
5
5
  data-testid="loan-card"
6
- style="box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);"
7
- :style="{ minWidth: '230px', maxWidth: '20.5rem' }"
6
+ style="box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.38);"
7
+ :style="{ minWidth: '230px', maxWidth: cardWidth }"
8
8
  >
9
9
  <div class="tw-grow">
10
10
  <div class="loan-card-active-hover">
@@ -63,9 +63,9 @@
63
63
  style="padding: 2px 6px;"
64
64
  >
65
65
  <kv-flag
66
- class="tw-mr-0.5"
66
+ class="tw-ml-0.5 tw-mr-1"
67
67
  :country="countryCode"
68
- width-override="0.725rem"
68
+ width-override="16px"
69
69
  hide-border
70
70
  />
71
71
  {{ formattedLocation }}
@@ -82,13 +82,14 @@
82
82
  :style="{ width: '60%', height: '1.75rem', 'border-radius': '500rem' }"
83
83
  />
84
84
 
85
- <h2
85
+ <h3
86
86
  class="loan-card-name"
87
- :class="{'tw-text-center': borrowerName.length < 20}"
87
+ :class="{ 'tw-text-center': borrowerName.length < 20 }"
88
+ style="font-size: 28px;"
88
89
  @click="clickReadMore('Name', $event)"
89
90
  >
90
91
  {{ borrowerName }}
91
- </h2>
92
+ </h3>
92
93
 
93
94
  <!-- Loan tag -->
94
95
 
@@ -99,17 +100,17 @@
99
100
  <kv-loading-placeholder
100
101
  v-if="isLoading || typeof loanCallouts === 'undefined'"
101
102
  class="tw-mt-0.5 tw-mb-1"
102
- :style="{ width: '20%', height: '1.75rem', 'border-radius': '500rem' }"
103
+ :style="{ width: '20%', height: '1.65rem', 'border-radius': '500rem' }"
103
104
  />
104
105
  <kv-loading-placeholder
105
106
  v-if="isLoading || typeof loanCallouts === 'undefined'"
106
107
  class="tw-mt-0.5 tw-mb-1"
107
- :style="{ width: '20%', height: '1.75rem', 'border-radius': '500rem' }"
108
+ :style="{ width: '20%', height: '1.65rem', 'border-radius': '500rem' }"
108
109
  />
109
110
  <kv-loading-placeholder
110
111
  v-if="isLoading || typeof loanCallouts === 'undefined'"
111
112
  class="tw-mt-0.5 tw-mb-1"
112
- :style="{ width: '20%', height: '1.75rem', 'border-radius': '500rem' }"
113
+ :style="{ width: '20%', height: '1.65rem', 'border-radius': '500rem' }"
113
114
  />
114
115
  </div>
115
116
 
@@ -139,7 +140,7 @@
139
140
  >
140
141
  <!-- Loan use -->
141
142
  <div
142
- class="tw-pt-1 tw-px-1"
143
+ class="tw-pt-0.5 tw-px-2"
143
144
  :class="{'tw-mb-1.5': !isLoading}"
144
145
  >
145
146
  <div
@@ -172,7 +173,7 @@
172
173
  </div>
173
174
  </div>
174
175
 
175
- <div class="tw-px-1">
176
+ <div class="tw-px-2">
176
177
  <!-- Fundraising -->
177
178
  <div
178
179
  v-if="!hasProgressData"
@@ -215,21 +216,28 @@
215
216
  </component>
216
217
  </div>
217
218
 
218
- <!-- Loan Match -->
219
+ <!-- Loan Tag -->
219
220
  <kv-loading-placeholder
220
221
  v-if="isLoading"
221
- class="tw-rounded tw-mx-auto tw-mt-1"
222
+ class="tw-rounded tw-mx-auto tw-mt-2"
222
223
  :style="{ width: '9rem', height: '1rem' }"
223
224
  />
224
225
 
225
- <div class="tw-pb-2.5">
226
- <kv-loan-tag
227
- v-if="matchingText"
228
- :loan="loan"
229
- variation="matched-loan"
230
- class="tw-text-center !tw-text-brand"
231
- />
226
+ <div
227
+ v-else-if="isFunded"
228
+ class="tw-bg-eco-green-1 tw-text-action tw-text-center tw-py-1.5"
229
+ style="font-weight: bold; font-size: 13px; border-radius: 8px;"
230
+ >
231
+ 🎉 Fully funded!
232
232
  </div>
233
+
234
+ <kv-loan-tag
235
+ v-else
236
+ :loan="loan"
237
+ :use-expanded-styles="true"
238
+ style="font-size: 15px;"
239
+ class="tw-text-center tw-pt-2"
240
+ />
233
241
  </div>
234
242
  </div>
235
243
  </template>
@@ -300,6 +308,10 @@ export default {
300
308
  type: Object,
301
309
  default: undefined,
302
310
  },
311
+ useFullWidth: {
312
+ type: Boolean,
313
+ default: false,
314
+ },
303
315
  },
304
316
  setup(props, { emit }) {
305
317
  const {
@@ -324,7 +336,7 @@ export default {
324
336
  state,
325
337
  tag,
326
338
  unreservedAmount,
327
- } = loanCardComputedProperties(props);
339
+ } = loanCardComputedProperties(props, true);
328
340
 
329
341
  const {
330
342
  clickReadMore,
@@ -356,6 +368,9 @@ export default {
356
368
  };
357
369
  },
358
370
  computed: {
371
+ cardWidth() {
372
+ return this.useFullWidth ? '100%' : '20.5rem';
373
+ },
359
374
  imageAspectRatio() {
360
375
  return 5 / 8;
361
376
  },
@@ -374,8 +389,8 @@ export default {
374
389
  const amount = this.loan?.loanFundraisingInfo?.fundedAmount ?? 0;
375
390
  return numeral(parseFloat(amount)).format('$0,0');
376
391
  },
377
- matchingText() {
378
- return this.loan?.matchingText ?? '';
392
+ isFunded() {
393
+ return this.loan?.status === 'funded' || parseFloat(this.unreservedAmount) === 0;
379
394
  },
380
395
  },
381
396
  };
@@ -383,7 +398,7 @@ export default {
383
398
 
384
399
  <style lang="postcss" scoped>
385
400
  .loan-callouts >>> span {
386
- @apply !tw-bg-transparent tw-text-brand;
401
+ @apply !tw-bg-transparent tw-text-action;
387
402
  }
388
403
  .loan-card-use:hover,
389
404
  .loan-card-use:focus {
package/vue/KvLoanTag.vue CHANGED
@@ -2,7 +2,7 @@
2
2
  <div
3
3
  v-if="!!variation"
4
4
  class="tw-text-small tw-font-medium tw-pt-0.5 tw-line-clamp-1"
5
- style="color: #CE4A00;"
5
+ :style="{ color: tagColor }"
6
6
  >
7
7
  {{ tagText }}
8
8
  <kv-countdown-timer
@@ -29,6 +29,10 @@ export default {
29
29
  type: Object,
30
30
  required: true,
31
31
  },
32
+ useExpandedStyles: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
32
36
  },
33
37
  data() {
34
38
  return {
@@ -59,11 +63,22 @@ export default {
59
63
  },
60
64
  tagText() {
61
65
  switch (this.variation) {
62
- case 'lse-loan': return 'High community impact';
63
- case 'almost-funded': return 'Almost funded';
64
- case 'matched-loan': return `${this.matchRatio + 1}x matching by ${this.loan?.matchingText}`;
65
- default: return 'Ending soon: ';
66
+ case 'lse-loan': return `${this.useExpandedStyles ? '⚡ ' : ''}High community impact`;
67
+ case 'almost-funded': return `${this.useExpandedStyles ? '💸 ' : ''}Almost funded`;
68
+ // eslint-disable-next-line max-len
69
+ case 'matched-loan': return `${this.useExpandedStyles ? '🤝 ' : ''}${this.matchRatio + 1}x matching by ${this.loan?.matchingText}`;
70
+ default: return `${this.useExpandedStyles ? '⏰ ' : ''}Ending soon: `;
71
+ }
72
+ },
73
+ tagColor() {
74
+ if (this.useExpandedStyles) {
75
+ switch (this.variation) {
76
+ case 'almost-funded': return '#AF741C';
77
+ case 'ending-soon': return '#CE2626';
78
+ default: return '#2B7C5F';
79
+ }
66
80
  }
81
+ return '#CE4A00';
67
82
  },
68
83
  matchRatio() {
69
84
  return this.loan?.matchRatio;
@@ -457,3 +457,24 @@ export const ContributorsAndAmount = story({
457
457
  photoPath,
458
458
  showContributors: true,
459
459
  });
460
+
461
+ export const USLoan = story({
462
+ loanId: loan.id,
463
+ loan: {
464
+ ...loan,
465
+ geocode: {
466
+ city: 'Kittanning',
467
+ state: 'PA',
468
+ country: {
469
+ isoCode: 'US',
470
+ name: 'United States',
471
+ region: 'North America',
472
+ __typename: 'Country',
473
+ },
474
+ __typename: 'Geocode',
475
+ },
476
+ distributionModel: 'direct',
477
+ },
478
+ kvTrackFunction,
479
+ photoPath,
480
+ });
@@ -84,14 +84,7 @@ const photoPath = 'https://www-kiva-org.freetls.fastly.net/img/';
84
84
 
85
85
  export const Default = story({
86
86
  loanId: loan.id,
87
- loan: {
88
- ...loan,
89
- loanFundraisingInfo: {
90
- fundedAmount: '200.00',
91
- isExpiringSoon: false,
92
- reservedAmount: '0.00',
93
- },
94
- },
87
+ loan,
95
88
  kvTrackFunction,
96
89
  photoPath,
97
90
  });
@@ -120,13 +113,87 @@ export const Matched = story({
120
113
  ...loan,
121
114
  matchingText: 'Ebay',
122
115
  matchRatio: 1,
116
+ },
117
+ kvTrackFunction,
118
+ photoPath,
119
+ });
120
+
121
+ export const LseLoan = story({
122
+ loanId: loan.id,
123
+ loan: {
124
+ ...loan,
125
+ partnerName: 'N/A, direct to Novulis',
126
+ },
127
+ kvTrackFunction,
128
+ photoPath,
129
+ });
130
+
131
+ export const AlmostFunded = story({
132
+ loanId: loan.id,
133
+ loan: {
134
+ ...loan,
135
+ loanAmount: '100.00',
136
+ unreservedAmount: '10.00',
137
+ fundraisingPercent: 0.9,
123
138
  loanFundraisingInfo: {
124
- fundedAmount: '200.00',
125
- isExpiringSoon: false,
139
+ fundedAmount: '90.00',
126
140
  reservedAmount: '0.00',
127
141
  },
128
142
  },
129
143
  kvTrackFunction,
130
144
  photoPath,
131
- loanCallouts: [{ label: 'callout 1' }, { label: 'callout 2' }, { label: 'callout 3' }],
145
+ });
146
+
147
+ const tomorrow = new Date();
148
+ tomorrow.setDate(new Date().getDate() + 1);
149
+
150
+ export const ExpiringSoon = story({
151
+ loanId: loan.id,
152
+ loan: {
153
+ ...loan,
154
+ plannedExpirationDate: tomorrow.toISOString(),
155
+ },
156
+ kvTrackFunction,
157
+ photoPath,
158
+ });
159
+
160
+ export const Funded = story({
161
+ loanId: loan.id,
162
+ loan: {
163
+ ...loan,
164
+ unreservedAmount: '0.00',
165
+ },
166
+ kvTrackFunction,
167
+ photoPath,
168
+ });
169
+
170
+ export const LongName = story({
171
+ loanId: loan.id,
172
+ loan: {
173
+ ...loan,
174
+ name: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
175
+ },
176
+ kvTrackFunction,
177
+ photoPath,
178
+ });
179
+
180
+ export const USLoan = story({
181
+ loanId: loan.id,
182
+ loan: {
183
+ ...loan,
184
+ geocode: {
185
+ city: 'Kittanning',
186
+ state: 'PA',
187
+ country: {
188
+ isoCode: 'US',
189
+ name: 'United States',
190
+ region: 'North America',
191
+ __typename: 'Country',
192
+ },
193
+ __typename: 'Geocode',
194
+ },
195
+ distributionModel: 'direct',
196
+ },
197
+ kvTrackFunction,
198
+ photoPath,
132
199
  });