@kiva/kv-components 3.18.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/package.json +2 -2
- package/vue/KvClassicLoanCard.vue +38 -18
- package/vue/KvLendAmountButton.vue +0 -8
- package/vue/KvLendCta.vue +42 -32
- package/vue/stories/KvClassicLoanCard.stories.js +23 -1
- package/vue/stories/KvLendAmountButton.stories.js +0 -3
- package/vue/stories/KvLendCta.stories.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.20.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.19.0...@kiva/kv-components@3.20.0) (2023-05-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* handle view loan when funded ([b6a392b](https://github.com/kiva/kv-ui-elements/commit/b6a392b0bbdcb09db37eba3d72e4b52b44eed41a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.19.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.18.0...@kiva/kv-components@3.19.0) (2023-05-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* loan card CTA fixes needed for home page ([fc1c9f8](https://github.com/kiva/kv-ui-elements/commit/fc1c9f858aeae620f6cfea74da8d15ae859afa3c))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.18.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.17.0...@kiva/kv-components@3.18.0) (2023-05-05)
|
|
7
29
|
|
|
8
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"optional": true
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "9552d0a6aa251b2c2ffb74a9f748ddbf6772c13b"
|
|
79
79
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
:id="`${loanId}-loan-card`"
|
|
4
3
|
class="tw-flex tw-flex-col tw-bg-white tw-rounded tw-w-full tw-pb-1"
|
|
5
4
|
:class="{ 'tw-p-1': !largeCard }"
|
|
6
5
|
style="box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);"
|
|
@@ -29,8 +28,10 @@
|
|
|
29
28
|
data-testid="loan-card-bookmark"
|
|
30
29
|
@toggle-bookmark="$emit('toggle-bookmark')"
|
|
31
30
|
/>
|
|
32
|
-
<
|
|
33
|
-
:
|
|
31
|
+
<component
|
|
32
|
+
:is="tag"
|
|
33
|
+
:to="readMorePath"
|
|
34
|
+
:href="readMorePath"
|
|
34
35
|
class="tw-flex"
|
|
35
36
|
aria-label="Borrower image"
|
|
36
37
|
@click="clickReadMore('Photo')"
|
|
@@ -74,12 +75,14 @@
|
|
|
74
75
|
{{ formattedLocation }}
|
|
75
76
|
</p>
|
|
76
77
|
</div>
|
|
77
|
-
</
|
|
78
|
+
</component>
|
|
78
79
|
</div>
|
|
79
80
|
|
|
80
81
|
<!-- Loan tag -->
|
|
81
|
-
<
|
|
82
|
-
:
|
|
82
|
+
<component
|
|
83
|
+
:is="tag"
|
|
84
|
+
:to="readMorePath"
|
|
85
|
+
:href="readMorePath"
|
|
83
86
|
class="tw-flex hover:tw-no-underline focus:tw-no-underline"
|
|
84
87
|
:class="{ 'tw-px-1': largeCard }"
|
|
85
88
|
aria-label="Loan tag"
|
|
@@ -90,10 +93,12 @@
|
|
|
90
93
|
:loan="loan"
|
|
91
94
|
:kv-track-function="kvTrackFunction"
|
|
92
95
|
/>
|
|
93
|
-
</
|
|
96
|
+
</component>
|
|
94
97
|
|
|
95
|
-
<
|
|
96
|
-
:
|
|
98
|
+
<component
|
|
99
|
+
:is="tag"
|
|
100
|
+
:to="readMorePath"
|
|
101
|
+
:href="readMorePath"
|
|
97
102
|
class="loan-card-use tw-text-primary"
|
|
98
103
|
aria-label="Loan use"
|
|
99
104
|
@click="clickReadMore('Use')"
|
|
@@ -106,11 +111,13 @@
|
|
|
106
111
|
:class="{ 'tw-px-1': largeCard }"
|
|
107
112
|
style="height: 5.5rem;"
|
|
108
113
|
>
|
|
109
|
-
<
|
|
114
|
+
<div
|
|
110
115
|
v-for="(_n, i) in [...Array(4)]"
|
|
111
116
|
:key="i"
|
|
112
|
-
class="tw-h-2 tw-mb-1
|
|
113
|
-
|
|
117
|
+
class="tw-h-2 tw-mb-1"
|
|
118
|
+
>
|
|
119
|
+
<kv-loading-placeholder />
|
|
120
|
+
</div>
|
|
114
121
|
</div>
|
|
115
122
|
<div v-else>
|
|
116
123
|
<kv-loan-use
|
|
@@ -124,7 +131,7 @@
|
|
|
124
131
|
/>
|
|
125
132
|
</div>
|
|
126
133
|
</div>
|
|
127
|
-
</
|
|
134
|
+
</component>
|
|
128
135
|
</div>
|
|
129
136
|
|
|
130
137
|
<!-- Loan call outs -->
|
|
@@ -163,9 +170,11 @@
|
|
|
163
170
|
/>
|
|
164
171
|
</div>
|
|
165
172
|
|
|
166
|
-
<
|
|
173
|
+
<component
|
|
174
|
+
:is="tag"
|
|
167
175
|
v-if="unreservedAmount > 0"
|
|
168
|
-
:to="
|
|
176
|
+
:to="readMorePath"
|
|
177
|
+
:href="readMorePath"
|
|
169
178
|
class="loan-card-progress tw-mt-1"
|
|
170
179
|
aria-label="Loan progress"
|
|
171
180
|
@click="clickReadMore('Progress')"
|
|
@@ -176,7 +185,7 @@
|
|
|
176
185
|
:progress-percent="fundraisingPercent"
|
|
177
186
|
class="tw-text-black"
|
|
178
187
|
/>
|
|
179
|
-
</
|
|
188
|
+
</component>
|
|
180
189
|
|
|
181
190
|
<!-- CTA Button -->
|
|
182
191
|
<kv-loading-placeholder
|
|
@@ -195,6 +204,7 @@
|
|
|
195
204
|
:kv-track-function="kvTrackFunction"
|
|
196
205
|
:show-view-loan="showViewLoan"
|
|
197
206
|
:custom-loan-details="customLoanDetails"
|
|
207
|
+
:external-links="externalLinks"
|
|
198
208
|
class="tw-mt-auto"
|
|
199
209
|
:class="{ 'tw-w-full' : unreservedAmount <= 0 }"
|
|
200
210
|
@add-to-basket="$emit('add-to-basket', $event)"
|
|
@@ -232,7 +242,7 @@ export default {
|
|
|
232
242
|
props: {
|
|
233
243
|
loanId: {
|
|
234
244
|
type: Number,
|
|
235
|
-
|
|
245
|
+
default: undefined,
|
|
236
246
|
},
|
|
237
247
|
loan: {
|
|
238
248
|
type: Object,
|
|
@@ -290,6 +300,10 @@ export default {
|
|
|
290
300
|
type: Boolean,
|
|
291
301
|
default: false,
|
|
292
302
|
},
|
|
303
|
+
externalLinks: {
|
|
304
|
+
type: Boolean,
|
|
305
|
+
default: false,
|
|
306
|
+
},
|
|
293
307
|
},
|
|
294
308
|
data() {
|
|
295
309
|
return {
|
|
@@ -297,8 +311,14 @@ export default {
|
|
|
297
311
|
};
|
|
298
312
|
},
|
|
299
313
|
computed: {
|
|
314
|
+
tag() {
|
|
315
|
+
return this.externalLinks ? 'a' : 'router-link';
|
|
316
|
+
},
|
|
317
|
+
readMorePath() {
|
|
318
|
+
return this.customLoanDetails ? '' : `/lend/${this.loanId}`;
|
|
319
|
+
},
|
|
300
320
|
isLoading() {
|
|
301
|
-
return !this.loan;
|
|
321
|
+
return !this.loanId || !this.loan;
|
|
302
322
|
},
|
|
303
323
|
cardWidth() {
|
|
304
324
|
return this.useFullWidth ? '100%' : '374px';
|
|
@@ -32,10 +32,6 @@ export default {
|
|
|
32
32
|
type: Boolean,
|
|
33
33
|
default: false,
|
|
34
34
|
},
|
|
35
|
-
isAdding: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false,
|
|
38
|
-
},
|
|
39
35
|
},
|
|
40
36
|
computed: {
|
|
41
37
|
amountValue() {
|
|
@@ -55,10 +51,6 @@ export default {
|
|
|
55
51
|
|
|
56
52
|
return str;
|
|
57
53
|
},
|
|
58
|
-
buttonState() {
|
|
59
|
-
if (this.isAdding) return 'loading';
|
|
60
|
-
return '';
|
|
61
|
-
},
|
|
62
54
|
},
|
|
63
55
|
methods: {
|
|
64
56
|
addToBasket(event) {
|
package/vue/KvLendCta.vue
CHANGED
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
<!-- Continue to checkout button -->
|
|
4
|
+
<kv-ui-button
|
|
5
|
+
v-if="isInBasket"
|
|
6
|
+
variant="secondary"
|
|
7
|
+
class="tw-inline-flex tw-flex-1"
|
|
8
|
+
data-testid="bp-lend-cta-checkout-button"
|
|
9
|
+
:to="!externalLinks ? '/basket' : undefined"
|
|
10
|
+
:href="externalLinks ? '/basket' : undefined"
|
|
11
|
+
@click.native="clickCheckout"
|
|
12
|
+
>
|
|
13
|
+
Checkout now
|
|
14
|
+
</kv-ui-button>
|
|
15
|
+
|
|
16
|
+
<!-- Refunded, allSharesReserved button -->
|
|
17
|
+
<kv-ui-button
|
|
18
|
+
v-else-if="showNonActionableLoanButton"
|
|
19
|
+
class="tw-inline-flex tw-flex-1"
|
|
20
|
+
>
|
|
21
|
+
{{ ctaButtonText }}
|
|
22
|
+
</kv-ui-button>
|
|
23
|
+
|
|
24
|
+
<!-- Funded / expired -->
|
|
25
|
+
<div
|
|
26
|
+
v-else-if="isFunded"
|
|
27
|
+
class="tw-w-full tw-text-center tw-rounded tw-p-2"
|
|
28
|
+
style="background: #f1f1f1;"
|
|
29
|
+
>
|
|
30
|
+
This loan was just funded! 🎉
|
|
31
|
+
</div>
|
|
32
|
+
|
|
3
33
|
<kv-ui-button
|
|
4
|
-
v-if="showViewLoan"
|
|
34
|
+
v-else-if="showViewLoan"
|
|
5
35
|
:state="`${allSharesReserved ? 'disabled' : ''}`"
|
|
6
|
-
:to="
|
|
36
|
+
:to="!externalLinks ? readMorePath : undefined"
|
|
37
|
+
:href="externalLinks ? readMorePath : undefined"
|
|
7
38
|
class="tw-mb-0"
|
|
8
39
|
@click="$emit('show-loan-details')"
|
|
9
40
|
>
|
|
@@ -15,6 +46,7 @@
|
|
|
15
46
|
/>
|
|
16
47
|
</span>
|
|
17
48
|
</kv-ui-button>
|
|
49
|
+
|
|
18
50
|
<form
|
|
19
51
|
v-else-if="useFormSubmit"
|
|
20
52
|
class="tw-w-full tw-flex"
|
|
@@ -90,35 +122,6 @@
|
|
|
90
122
|
</kv-ui-button>
|
|
91
123
|
</fieldset>
|
|
92
124
|
</form>
|
|
93
|
-
|
|
94
|
-
<!-- Continue to checkout button -->
|
|
95
|
-
<kv-ui-button
|
|
96
|
-
v-if="state === 'basketed'"
|
|
97
|
-
variant="secondary"
|
|
98
|
-
class="tw-inline-flex tw-flex-1"
|
|
99
|
-
data-testid="bp-lend-cta-checkout-button"
|
|
100
|
-
to="/basket"
|
|
101
|
-
@click.native="clickCheckout"
|
|
102
|
-
>
|
|
103
|
-
Checkout now
|
|
104
|
-
</kv-ui-button>
|
|
105
|
-
|
|
106
|
-
<!-- Refunded, allSharesReserved button -->
|
|
107
|
-
<kv-ui-button
|
|
108
|
-
v-if="showNonActionableLoanButton"
|
|
109
|
-
class="tw-inline-flex tw-flex-1"
|
|
110
|
-
>
|
|
111
|
-
{{ ctaButtonText }}
|
|
112
|
-
</kv-ui-button>
|
|
113
|
-
|
|
114
|
-
<!-- Funded / expired -->
|
|
115
|
-
<div
|
|
116
|
-
v-if="isFunded"
|
|
117
|
-
class="tw-w-full tw-text-center tw-rounded tw-p-2"
|
|
118
|
-
style="background: #f1f1f1;"
|
|
119
|
-
>
|
|
120
|
-
This loan was just funded! 🎉
|
|
121
|
-
</div>
|
|
122
125
|
</div>
|
|
123
126
|
</template>
|
|
124
127
|
|
|
@@ -171,6 +174,10 @@ export default {
|
|
|
171
174
|
type: Boolean,
|
|
172
175
|
default: false,
|
|
173
176
|
},
|
|
177
|
+
externalLinks: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: false,
|
|
180
|
+
},
|
|
174
181
|
},
|
|
175
182
|
data() {
|
|
176
183
|
return {
|
|
@@ -179,6 +186,9 @@ export default {
|
|
|
179
186
|
};
|
|
180
187
|
},
|
|
181
188
|
computed: {
|
|
189
|
+
readMorePath() {
|
|
190
|
+
return this.customLoanDetails ? '' : `/lend/${this.loanId}`;
|
|
191
|
+
},
|
|
182
192
|
loanId() {
|
|
183
193
|
return this.loan?.id;
|
|
184
194
|
},
|
|
@@ -230,7 +240,7 @@ export default {
|
|
|
230
240
|
useFormSubmit() {
|
|
231
241
|
if (this.hideShowLendDropdown
|
|
232
242
|
|| this.lendButtonVisibility
|
|
233
|
-
|| this.
|
|
243
|
+
|| this.showLendAgain
|
|
234
244
|
|| this.state === 'lent-to'
|
|
235
245
|
|| this.isAdding) {
|
|
236
246
|
return true;
|
|
@@ -143,7 +143,7 @@ export const AllSharesReserved = story({
|
|
|
143
143
|
},
|
|
144
144
|
kvTrackFunction,
|
|
145
145
|
photoPath,
|
|
146
|
-
}
|
|
146
|
+
});
|
|
147
147
|
|
|
148
148
|
export const InBasket = story({
|
|
149
149
|
loanId: loan.id,
|
|
@@ -213,3 +213,25 @@ export const ViewLoan = story({
|
|
|
213
213
|
photoPath,
|
|
214
214
|
showViewLoan: true,
|
|
215
215
|
});
|
|
216
|
+
|
|
217
|
+
export const ViewLoanFunded = story({
|
|
218
|
+
loanId: loan.id,
|
|
219
|
+
loan: {
|
|
220
|
+
...loan,
|
|
221
|
+
unreservedAmount: '0.00',
|
|
222
|
+
fundraisingPercent: 1,
|
|
223
|
+
},
|
|
224
|
+
kvTrackFunction,
|
|
225
|
+
photoPath,
|
|
226
|
+
showViewLoan: true,
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
export const LendAgain = story({
|
|
230
|
+
loanId: loan.id,
|
|
231
|
+
loan: {
|
|
232
|
+
...loan,
|
|
233
|
+
userProperties: { lentTo: true },
|
|
234
|
+
},
|
|
235
|
+
kvTrackFunction,
|
|
236
|
+
photoPath,
|
|
237
|
+
});
|
|
@@ -15,7 +15,6 @@ const story = (args) => {
|
|
|
15
15
|
:show-now="showNow"
|
|
16
16
|
:amount-left="amountLeft"
|
|
17
17
|
:complete-loan="completeLoan"
|
|
18
|
-
:is-adding="isAdding"
|
|
19
18
|
/>
|
|
20
19
|
`,
|
|
21
20
|
});
|
|
@@ -30,5 +29,3 @@ export const ShowNow = story({ showNow: true });
|
|
|
30
29
|
export const AmountLeft = story({ amountLeft: 5 });
|
|
31
30
|
|
|
32
31
|
export const CompleteLoan = story({ completeLoan: true });
|
|
33
|
-
|
|
34
|
-
export const IsAdding = story({ isAdding: true });
|