@kiva/kv-components 3.17.0 → 3.19.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 +45 -18
- package/vue/KvLendAmountButton.vue +0 -8
- package/vue/KvLendCta.vue +41 -5
- package/vue/stories/KvClassicLoanCard.stories.js +19 -0
- package/vue/stories/KvLendAmountButton.stories.js +0 -3
- package/vue/stories/KvLendCta.stories.js +12 -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.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)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* loan card CTA fixes needed for home page ([fc1c9f8](https://github.com/kiva/kv-ui-elements/commit/fc1c9f858aeae620f6cfea74da8d15ae859afa3c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* "view loan" CTA ([aa10cf1](https://github.com/kiva/kv-ui-elements/commit/aa10cf17a1ca4978b97fc9541522f31d95cc886f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.17.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.16.0...@kiva/kv-components@3.17.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.19.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": "b816407effcdecfc0487c5bfb91838f9c4f25a85"
|
|
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
|
|
@@ -193,9 +202,13 @@
|
|
|
193
202
|
:is-adding="isAdding"
|
|
194
203
|
:enable-five-dollars-notes="enableFiveDollarsNotes"
|
|
195
204
|
:kv-track-function="kvTrackFunction"
|
|
205
|
+
:show-view-loan="showViewLoan"
|
|
206
|
+
:custom-loan-details="customLoanDetails"
|
|
207
|
+
:external-links="externalLinks"
|
|
196
208
|
class="tw-mt-auto"
|
|
197
209
|
:class="{ 'tw-w-full' : unreservedAmount <= 0 }"
|
|
198
210
|
@add-to-basket="$emit('add-to-basket', $event)"
|
|
211
|
+
@show-loan-details="clickReadMore('ViewLoan')"
|
|
199
212
|
/>
|
|
200
213
|
</div>
|
|
201
214
|
</div>
|
|
@@ -229,7 +242,7 @@ export default {
|
|
|
229
242
|
props: {
|
|
230
243
|
loanId: {
|
|
231
244
|
type: Number,
|
|
232
|
-
|
|
245
|
+
default: undefined,
|
|
233
246
|
},
|
|
234
247
|
loan: {
|
|
235
248
|
type: Object,
|
|
@@ -283,6 +296,14 @@ export default {
|
|
|
283
296
|
type: String,
|
|
284
297
|
required: true,
|
|
285
298
|
},
|
|
299
|
+
showViewLoan: {
|
|
300
|
+
type: Boolean,
|
|
301
|
+
default: false,
|
|
302
|
+
},
|
|
303
|
+
externalLinks: {
|
|
304
|
+
type: Boolean,
|
|
305
|
+
default: false,
|
|
306
|
+
},
|
|
286
307
|
},
|
|
287
308
|
data() {
|
|
288
309
|
return {
|
|
@@ -290,8 +311,14 @@ export default {
|
|
|
290
311
|
};
|
|
291
312
|
},
|
|
292
313
|
computed: {
|
|
314
|
+
tag() {
|
|
315
|
+
return this.externalLinks ? 'a' : 'router-link';
|
|
316
|
+
},
|
|
317
|
+
readMorePath() {
|
|
318
|
+
return this.customLoanDetails ? '' : `/lend/${this.loanId}`;
|
|
319
|
+
},
|
|
293
320
|
isLoading() {
|
|
294
|
-
return !this.loan;
|
|
321
|
+
return !this.loanId || !this.loan;
|
|
295
322
|
},
|
|
296
323
|
cardWidth() {
|
|
297
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,7 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
<kv-ui-button
|
|
4
|
+
v-if="showViewLoan && !isInBasket"
|
|
5
|
+
:state="`${allSharesReserved ? 'disabled' : ''}`"
|
|
6
|
+
:to="!externalLinks ? readMorePath : undefined"
|
|
7
|
+
:href="externalLinks ? readMorePath : undefined"
|
|
8
|
+
class="tw-mb-0"
|
|
9
|
+
@click="$emit('show-loan-details')"
|
|
10
|
+
>
|
|
11
|
+
<span class="tw-flex">
|
|
12
|
+
View loan
|
|
13
|
+
<kv-material-icon
|
|
14
|
+
class="tw-w-3 tw-h-3 tw-align-middle"
|
|
15
|
+
:icon="mdiChevronRight"
|
|
16
|
+
/>
|
|
17
|
+
</span>
|
|
18
|
+
</kv-ui-button>
|
|
3
19
|
<form
|
|
4
|
-
v-if="useFormSubmit"
|
|
20
|
+
v-else-if="useFormSubmit"
|
|
5
21
|
class="tw-w-full tw-flex"
|
|
6
22
|
@submit.prevent="addToBasket"
|
|
7
23
|
>
|
|
@@ -45,7 +61,7 @@
|
|
|
45
61
|
|
|
46
62
|
<!-- Lend again/lent previously button -->
|
|
47
63
|
<kv-ui-button
|
|
48
|
-
v-if="showLendAgain"
|
|
64
|
+
v-else-if="showLendAgain"
|
|
49
65
|
key="lendAgainButton"
|
|
50
66
|
class="lend-again"
|
|
51
67
|
data-testid="bp-lend-cta-lend-again-button"
|
|
@@ -78,11 +94,12 @@
|
|
|
78
94
|
|
|
79
95
|
<!-- Continue to checkout button -->
|
|
80
96
|
<kv-ui-button
|
|
81
|
-
v-if="
|
|
97
|
+
v-if="isInBasket"
|
|
82
98
|
variant="secondary"
|
|
83
99
|
class="tw-inline-flex tw-flex-1"
|
|
84
100
|
data-testid="bp-lend-cta-checkout-button"
|
|
85
|
-
to="/basket"
|
|
101
|
+
:to="!externalLinks ? '/basket' : undefined"
|
|
102
|
+
:href="externalLinks ? '/basket' : undefined"
|
|
86
103
|
@click.native="clickCheckout"
|
|
87
104
|
>
|
|
88
105
|
Checkout now
|
|
@@ -109,9 +126,11 @@
|
|
|
109
126
|
|
|
110
127
|
<script>
|
|
111
128
|
import numeral from 'numeral';
|
|
129
|
+
import { mdiChevronRight } from '@mdi/js';
|
|
112
130
|
import KvLendAmountButton from './KvLendAmountButton.vue';
|
|
113
131
|
import KvUiSelect from './KvSelect.vue';
|
|
114
132
|
import KvUiButton from './KvButton.vue';
|
|
133
|
+
import KvMaterialIcon from './KvMaterialIcon.vue';
|
|
115
134
|
|
|
116
135
|
export default {
|
|
117
136
|
name: 'KvLendCta',
|
|
@@ -119,6 +138,7 @@ export default {
|
|
|
119
138
|
KvLendAmountButton,
|
|
120
139
|
KvUiButton,
|
|
121
140
|
KvUiSelect,
|
|
141
|
+
KvMaterialIcon,
|
|
122
142
|
},
|
|
123
143
|
props: {
|
|
124
144
|
loan: {
|
|
@@ -145,13 +165,29 @@ export default {
|
|
|
145
165
|
type: Function,
|
|
146
166
|
required: true,
|
|
147
167
|
},
|
|
168
|
+
showViewLoan: {
|
|
169
|
+
type: Boolean,
|
|
170
|
+
default: false,
|
|
171
|
+
},
|
|
172
|
+
customLoanDetails: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
default: false,
|
|
175
|
+
},
|
|
176
|
+
externalLinks: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: false,
|
|
179
|
+
},
|
|
148
180
|
},
|
|
149
181
|
data() {
|
|
150
182
|
return {
|
|
183
|
+
mdiChevronRight,
|
|
151
184
|
selectedOption: this.getSelectedOption(this.loan?.unreservedAmount),
|
|
152
185
|
};
|
|
153
186
|
},
|
|
154
187
|
computed: {
|
|
188
|
+
readMorePath() {
|
|
189
|
+
return this.customLoanDetails ? '' : `/lend/${this.loanId}`;
|
|
190
|
+
},
|
|
155
191
|
loanId() {
|
|
156
192
|
return this.loan?.id;
|
|
157
193
|
},
|
|
@@ -203,7 +239,7 @@ export default {
|
|
|
203
239
|
useFormSubmit() {
|
|
204
240
|
if (this.hideShowLendDropdown
|
|
205
241
|
|| this.lendButtonVisibility
|
|
206
|
-
|| this.
|
|
242
|
+
|| this.showLendAgain
|
|
207
243
|
|| this.state === 'lent-to'
|
|
208
244
|
|| this.isAdding) {
|
|
209
245
|
return true;
|
|
@@ -26,6 +26,7 @@ const story = (args) => {
|
|
|
26
26
|
:is-bookmarked="isBookmarked"
|
|
27
27
|
:kv-track-function="kvTrackFunction"
|
|
28
28
|
:photo-path="photoPath"
|
|
29
|
+
:show-view-loan="showViewLoan"
|
|
29
30
|
/>
|
|
30
31
|
</div>
|
|
31
32
|
`,
|
|
@@ -204,3 +205,21 @@ export const FiveDollarNotes = story({
|
|
|
204
205
|
kvTrackFunction,
|
|
205
206
|
photoPath,
|
|
206
207
|
});
|
|
208
|
+
|
|
209
|
+
export const ViewLoan = story({
|
|
210
|
+
loanId: loan.id,
|
|
211
|
+
loan,
|
|
212
|
+
kvTrackFunction,
|
|
213
|
+
photoPath,
|
|
214
|
+
showViewLoan: true,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export const LendAgain = story({
|
|
218
|
+
loanId: loan.id,
|
|
219
|
+
loan: {
|
|
220
|
+
...loan,
|
|
221
|
+
userProperties: { lentTo: true },
|
|
222
|
+
},
|
|
223
|
+
kvTrackFunction,
|
|
224
|
+
photoPath,
|
|
225
|
+
});
|
|
@@ -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 });
|
|
@@ -18,6 +18,8 @@ const story = (args) => {
|
|
|
18
18
|
:is-adding="isAdding"
|
|
19
19
|
:enable-five-dollars-notes="enableFiveDollarsNotes"
|
|
20
20
|
:kv-track-function="kvTrackFunction"
|
|
21
|
+
:show-view-loan="showViewLoan"
|
|
22
|
+
:custom-loan-details="customLoanDetails"
|
|
21
23
|
/>
|
|
22
24
|
</div>
|
|
23
25
|
`,
|
|
@@ -102,3 +104,13 @@ export const LendAgain = story({
|
|
|
102
104
|
},
|
|
103
105
|
kvTrackFunction,
|
|
104
106
|
});
|
|
107
|
+
|
|
108
|
+
export const ViewLoan = story({
|
|
109
|
+
isLoading: false,
|
|
110
|
+
loan: {
|
|
111
|
+
id: 1,
|
|
112
|
+
unreservedAmount: '150.00',
|
|
113
|
+
},
|
|
114
|
+
kvTrackFunction,
|
|
115
|
+
showViewLoan: true,
|
|
116
|
+
});
|