Skip to content

Commit

Permalink
Merge branch 'main' of github.com:kiva/ui into MP-837_my_kiva_badges_…
Browse files Browse the repository at this point in the history
…section
  • Loading branch information
roger-in-kiva committed Oct 17, 2024
2 parents c66350d + 17c0644 commit cd237d4
Show file tree
Hide file tree
Showing 12 changed files with 487 additions and 38 deletions.
129 changes: 129 additions & 0 deletions .storybook/mock-data/contentful-badge-data-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
export default {
"metadata": {
"tags": [],
"concepts": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "j0p9a6ql0rn7"
}
},
"id": "5qVq3IF07C8um3AiQVjLK5",
"type": "Entry",
"createdAt": "2024-10-08T20:25:25.114Z",
"updatedAt": "2024-10-15T23:11:19.111Z",
"environment": {
"sys": {
"id": "development",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 4,
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "challenge"
}
},
"locale": "en-US"
},
"fields": {
"key": "us-economic-equality-level-2",
"challengeName": "U.S. Economic equality (level 2)",
"badgeImage": {
"metadata": {
"tags": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "j0p9a6ql0rn7"
}
},
"id": "62zEUpZbO7qWZPoV1z2pZU",
"type": "Asset",
"createdAt": "2024-10-08T20:25:01.320Z",
"updatedAt": "2024-10-08T20:25:01.320Z",
"environment": {
"sys": {
"id": "development",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 1,
"locale": "en-US"
},
"fields": {
"title": "US Economic Equality Level 2",
"description": "",
"file": {
"url": "//images.ctfassets.net/j0p9a6ql0rn7/62zEUpZbO7qWZPoV1z2pZU/f094aa821bdf8a5f8634b28562135594/US_Economic_Equality_Level_2.svg",
"details": {
"size": 18162550,
"image": {
"width": 2382,
"height": 2382
}
},
"fileName": "US Economic Equality Level 2.svg",
"contentType": "image/svg+xml"
}
}
},
"thankYouImage": {
"metadata": {
"tags": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "j0p9a6ql0rn7"
}
},
"id": "62zEUpZbO7qWZPoV1z2pZU",
"type": "Asset",
"createdAt": "2024-10-08T20:25:01.320Z",
"updatedAt": "2024-10-08T20:25:01.320Z",
"environment": {
"sys": {
"id": "development",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 1,
"locale": "en-US"
},
"fields": {
"title": "US Economic Equality Level 2",
"description": "",
"file": {
"url": "//images.ctfassets.net/j0p9a6ql0rn7/62zEUpZbO7qWZPoV1z2pZU/f094aa821bdf8a5f8634b28562135594/US_Economic_Equality_Level_2.svg",
"details": {
"size": 18162550,
"image": {
"width": 2382,
"height": 2382
}
},
"fileName": "US Economic Equality Level 2.svg",
"contentType": "image/svg+xml"
}
}
},
"shareFact": "3 in 5 U.S. business owners brought in more income after their Kiva loan.*",
"shareFactUrl": "/",
"dateTagline": "N/A",
"shareFactFootnote": "Kiva borrowers surveyed by 60 Decibels."
}
}
50 changes: 50 additions & 0 deletions .storybook/mock-data/tiered-lending-achievement-data-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export default [{
"id": "us-economic-equality",
"tiers": [
{
"completedDate": "2021-01-01T00:00:00Z",
"learnMoreURL": "",
"target": 2,
"tierStatement": ""
},
{
"completedDate": "2021-01-01T00:00:00Z",
"learnMoreURL": "",
"target": 3,
"tierStatement": ""
},
{
"completedDate": "2021-01-01T00:00:00Z",
"learnMoreURL": "",
"target": 5,
"tierStatement": ""
},
{
"completedDate": "2021-01-01T00:00:00Z",
"learnMoreURL": "",
"target": 10,
"tierStatement": ""
},
{
"completedDate": "2021-04-20T00:00:00Z",
"learnMoreURL": "https://www.kiva.org/impact/systemically-marginalized-communities",
"target": 20,
"tierStatement": "70% of U.S. business owners surveyed were more confident in their business as a result of their loan.*"
},
{
"completedDate": null,
"learnMoreURL": "",
"target": 50,
"tierStatement": ""
},
{
"completedDate": null,
"learnMoreURL": "",
"target": 100,
"tierStatement": ""
},
],
"description": "description",
"totalProgressToAchievement": 0,
"status": "PARTIALLY_COMPLETE"
}]
31 changes: 31 additions & 0 deletions .storybook/stories/MyKivaBadgeCompleted.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import BadgeCompleted from '#src/components/MyKiva/BadgeCompleted.vue';
import contentfulBadge from '../mock-data/contentful-badge-data-mock';
import tieredLendingAchievement from '../mock-data/tiered-lending-achievement-data-mock';

export default {
title: 'MyKiva/BadgeCompleted',
component: BadgeCompleted,
};

const story = (args = {}) => {
const template = (_args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { BadgeCompleted },
setup() { return { args }; },
template: `
<badge-completed v-bind="args" />
`,
});
template.args = args;
return template;
};

export const Default = story({
badge: contentfulBadge,
lendingAchievement: tieredLendingAchievement[0],
lender: {
publicName: 'Christian',
public: true,
publicId: 'christian78848470'
}
});
6 changes: 3 additions & 3 deletions src/components/Checkout/CheckoutDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
'Where should we email your receipt?'
)"
/>
<p v-if="promoGuestCheckoutEnabled && v$.email?.$invalid">
<p v-if="promoGuestCheckoutEnabled && v$.email?.$error">
Valid campaign email required
</p>
<p v-else-if="v$.email?.$invalid" class="input-error tw-text-danger tw-text-base tw-mb-2">
<p v-else-if="v$.email?.$error" class="input-error tw-text-danger tw-text-base tw-mb-2">
Valid email required.
</p>
<user-updates-preference
Expand Down Expand Up @@ -87,7 +87,7 @@
target="_blank"
:title="`Open Privacy ${enableCommsExperiment ? 'Notice' : 'Policy' } in a new window`"
>Privacy {{ enableCommsExperiment ? 'Notice' : 'Policy' }}</a>.
<p v-if="v$.termsAgreement?.$invalid" class="input-error tw-text-danger tw-text-base">
<p v-if="v$.termsAgreement?.$error" class="input-error tw-text-danger tw-text-base">
You must agree to the Kiva Terms of service & Privacy
{{ enableCommsExperiment ? 'Notice' : 'Policy' }}.
</p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Checkout/KivaCreditGuestPayment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'Where should we email your receipt?'
)"
/>
<p v-if="v$.email?.$invalid" class="input-error tw-text-danger tw-text-base tw-mb-2">
<p v-if="v$.email?.$error" class="input-error tw-text-danger tw-text-base tw-mb-2">
Valid email required.
</p>
<kv-checkbox
Expand Down Expand Up @@ -50,7 +50,7 @@
target="_blank"
title="Open Privacy Policy in a new window"
>Privacy Policy</a>.
<p v-if="v$.termsAgreement?.$invalid" class="input-error tw-text-danger tw-text-base">
<p v-if="v$.termsAgreement?.$error" class="input-error tw-text-danger tw-text-base">
You must agree to the Kiva Terms of service & Privacy
policy.
</p>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Checkout/UserUpdatesPreference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@input="event => $emit('update:modelValue', event.target.value)"
class="tw-flex tw-flex-col tw-gap-2 tw-mt-1 tw-mb-2 tw-text-small"
>
<div :class="{'radio-error': v$.selectedComms?.$invalid}">
<div :class="{'radio-error': v$.selectedComms?.$error}">
<kv-radio
value="on"
v-model="selectedComms"
Expand All @@ -21,7 +21,7 @@
Send me updates from people I've funded, my impact, and other ways I can help.
</kv-radio>
</div>
<div :class="{'radio-error': v$.selectedComms?.$invalid}">
<div :class="{'radio-error': v$.selectedComms?.$error}">
<kv-radio
value="off"
name="newsConsent"
Expand All @@ -40,7 +40,7 @@
</div>
</fieldset>
<p
v-if="v$.selectedComms?.$invalid"
v-if="v$.selectedComms?.$error"
class="input-error tw-text-danger tw-text-base tw-mb-2 tw-text-small"
>
Choose your communication preferences.
Expand Down
50 changes: 26 additions & 24 deletions src/components/Forms/GuestAccountCreation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@
id="guestUpsellForm"
@submit.prevent.stop="submit"
>
<kv-base-input
name="firstName"
class="data-hj-suppress tw-mb-2"
type="text"
v-model.trim="firstName"
:validation="v$.firstName"
>
First name
<template #required>
Enter first name.
</template>
</kv-base-input>
<kv-base-input
name="lastName"
class="data-hj-suppress tw-mb-2"
type="text"
v-model.trim="lastName"
:validation="v$.lastName"
>
Last name
<template #required>
Enter last name.
</template>
</kv-base-input>
<div class="data-hj-suppress tw-mb-2">
<kv-base-input
name="firstName"
type="text"
v-model.trim="firstName"
:validation="v$.firstName"
>
First name
<template #required>
Enter first name.
</template>
</kv-base-input>
</div>
<div class="data-hj-suppress tw-mb-2">
<kv-base-input
name="lastName"
type="text"
v-model.trim="lastName"
:validation="v$.lastName"
>
Last name
<template #required>
Enter last name.
</template>
</kv-base-input>
</div>
<p
v-if="serverError"
class="tw-text-danger tw-text-small tw-font-medium tw-mb-2"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Kv/KvLoadingOverlay.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div class="loading-overlay">
<div class="spinner-wrapper" :style="{ top }">
<kv-loading-spinner />
<kv-loading-spinner size="large" />
</div>
</div>
</template>

<script>
import _throttle from 'lodash/throttle';
import KvLoadingSpinner from '#src/components/Kv/KvLoadingSpinner';
import KvLoadingSpinner from '@kiva/kv-components/vue/KvLoadingSpinner';
import getCacheKey from '#src/util/getCacheKey';
export default {
Expand Down
Loading

0 comments on commit cd237d4

Please sign in to comment.