@kiva/kv-components 3.48.2 → 3.49.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 +23 -0
- package/package.json +2 -2
- package/utils/loanCard.js +5 -5
- package/vue/KvVotingCard.vue +152 -0
- package/vue/stories/KvVotingCard.stories.js +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.49.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.48.3...@kiva/kv-components@3.49.0) (2024-01-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* vote button variant ([d58fe0c](https://github.com/kiva/kv-ui-elements/commit/d58fe0c9d16b3139d36e7d61bc2c3b4fbb5d1f0d))
|
|
12
|
+
* voting category cards ([8938dff](https://github.com/kiva/kv-ui-elements/commit/8938dff740c79eaf09e8543ad384c97decee2634))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [3.48.3](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.48.2...@kiva/kv-components@3.48.3) (2023-12-08)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* p4 tag on loan card ([8513e93](https://github.com/kiva/kv-ui-elements/commit/8513e93addcb68f9f6f17f4eb52ee4d33f6af481))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [3.48.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.48.1...@kiva/kv-components@3.48.2) (2023-12-06)
|
|
7
30
|
|
|
8
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.49.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": "efc7a48388a2ed44b08b55c596e5fd261b9e8a2f"
|
|
79
79
|
}
|
package/utils/loanCard.js
CHANGED
|
@@ -83,8 +83,8 @@ export function loanCardComputedProperties(props) {
|
|
|
83
83
|
// Tag as first option for LSE loans
|
|
84
84
|
if (isLseLoan && tags.length) {
|
|
85
85
|
const position = Math.floor(Math.random() * tags.length);
|
|
86
|
-
const
|
|
87
|
-
callouts.push(
|
|
86
|
+
const p1Tag = tags[position];
|
|
87
|
+
callouts.push(p1Tag);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
if (!categoryPageName.value) {
|
|
@@ -116,9 +116,9 @@ export function loanCardComputedProperties(props) {
|
|
|
116
116
|
// P4 Tag
|
|
117
117
|
if (!!tags.length && callouts.length < 2) {
|
|
118
118
|
const position = Math.floor(Math.random() * tags.length);
|
|
119
|
-
const
|
|
120
|
-
if (!callouts.filter((c) => c.toUpperCase() ===
|
|
121
|
-
callouts.push(
|
|
119
|
+
const p4Tag = tags[position];
|
|
120
|
+
if (!callouts.filter((c) => c.toUpperCase() === p4Tag.toUpperCase()).length) {
|
|
121
|
+
callouts.push(p4Tag);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="
|
|
4
|
+
kv-voting-card
|
|
5
|
+
tw-bg-white
|
|
6
|
+
tw-rounded
|
|
7
|
+
tw-shadow
|
|
8
|
+
tw-p-1
|
|
9
|
+
tw-flex
|
|
10
|
+
tw-flex-col
|
|
11
|
+
tw-items-center
|
|
12
|
+
tw-justify-between
|
|
13
|
+
tw-max-w-300"
|
|
14
|
+
>
|
|
15
|
+
<div class="tw-relative tw-flex tw-w-full tw-bg-black tw-rounded tw-mb-1">
|
|
16
|
+
<kv-borrower-image
|
|
17
|
+
class="tw-rounded"
|
|
18
|
+
:alt="`Photo of ${borrowerName}`"
|
|
19
|
+
:aspect-ratio="aspectRatio"
|
|
20
|
+
:default-image="defaultImage"
|
|
21
|
+
:hash="hash"
|
|
22
|
+
:images="images"
|
|
23
|
+
:photo-path="photoPath"
|
|
24
|
+
/>
|
|
25
|
+
<p
|
|
26
|
+
class="
|
|
27
|
+
tw-absolute
|
|
28
|
+
tw-bottom-1
|
|
29
|
+
tw-left-1
|
|
30
|
+
tw-text-primary
|
|
31
|
+
tw-bg-white
|
|
32
|
+
tw-rounded
|
|
33
|
+
tw-text-h4
|
|
34
|
+
tw-inline-flex
|
|
35
|
+
tw-items-center"
|
|
36
|
+
style="padding: 2px 6px; text-transform: capitalize;"
|
|
37
|
+
>
|
|
38
|
+
<kv-material-icon
|
|
39
|
+
class="tw-h-2 tw-w-2"
|
|
40
|
+
:icon="mapMarkerIcon"
|
|
41
|
+
/>
|
|
42
|
+
{{ borrowerName }}, {{ country }}
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<h3 class="tw-font-medium">
|
|
47
|
+
{{ category }}
|
|
48
|
+
</h3>
|
|
49
|
+
<div class="tw-flex tw-items-center tw-w-full tw-mb-1">
|
|
50
|
+
<kv-progress-bar
|
|
51
|
+
class="tw-flex-grow"
|
|
52
|
+
:aria-label="'Percent of votes for ' + category"
|
|
53
|
+
:value="percentage"
|
|
54
|
+
/>
|
|
55
|
+
<div class="tw-ml-2 tw-font-medium">
|
|
56
|
+
{{ percentage }}%
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
<kv-button
|
|
60
|
+
v-if="showVoteButton"
|
|
61
|
+
class="tw-w-full"
|
|
62
|
+
@click="showVoteButton"
|
|
63
|
+
>
|
|
64
|
+
Vote
|
|
65
|
+
</kv-button>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import { mdiMapMarker } from '@mdi/js';
|
|
71
|
+
import {
|
|
72
|
+
computed,
|
|
73
|
+
} from 'vue-demi';
|
|
74
|
+
import KvBorrowerImage from './KvBorrowerImage.vue';
|
|
75
|
+
import KvProgressBar from './KvProgressBar.vue';
|
|
76
|
+
import KvButton from './KvButton.vue';
|
|
77
|
+
import KvMaterialIcon from './KvMaterialIcon.vue';
|
|
78
|
+
|
|
79
|
+
export default {
|
|
80
|
+
name: 'KvVotingCard',
|
|
81
|
+
components: {
|
|
82
|
+
KvBorrowerImage,
|
|
83
|
+
KvProgressBar,
|
|
84
|
+
KvButton,
|
|
85
|
+
KvMaterialIcon,
|
|
86
|
+
},
|
|
87
|
+
props: {
|
|
88
|
+
borrowerName: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: '',
|
|
91
|
+
},
|
|
92
|
+
country: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '',
|
|
95
|
+
},
|
|
96
|
+
category: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: '',
|
|
99
|
+
},
|
|
100
|
+
aspectRatio: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 1,
|
|
103
|
+
},
|
|
104
|
+
hash: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: '',
|
|
107
|
+
},
|
|
108
|
+
images: {
|
|
109
|
+
type: Array,
|
|
110
|
+
default: () => [],
|
|
111
|
+
},
|
|
112
|
+
photoPath: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: '',
|
|
115
|
+
},
|
|
116
|
+
defaultImage: {
|
|
117
|
+
type: Object,
|
|
118
|
+
default: () => ({ width: 300 }),
|
|
119
|
+
},
|
|
120
|
+
percentage: {
|
|
121
|
+
type: Number,
|
|
122
|
+
default: 0,
|
|
123
|
+
},
|
|
124
|
+
showVoteButton: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: true,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
emits: ['vote'],
|
|
130
|
+
setup() {
|
|
131
|
+
const mapMarkerIcon = computed(() => {
|
|
132
|
+
return mdiMapMarker;
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
mapMarkerIcon,
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
methods: {
|
|
139
|
+
castVote() {
|
|
140
|
+
this.$emit('vote', {
|
|
141
|
+
category: this.category,
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<style scoped>
|
|
149
|
+
.kv-voting-card {
|
|
150
|
+
max-width: 300px;
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import KvVotingCard from '../KvVotingCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvVotingCard',
|
|
5
|
+
component: KvVotingCard,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => ({
|
|
9
|
+
components: { KvVotingCard },
|
|
10
|
+
setup() {
|
|
11
|
+
return { args };
|
|
12
|
+
},
|
|
13
|
+
template: '<kv-voting-card v-bind="args" />',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {
|
|
18
|
+
borrowerName: 'Jacqueline',
|
|
19
|
+
country: 'Rwanda',
|
|
20
|
+
category: 'Women-owned retail businesses',
|
|
21
|
+
aspectRatio: 0.75,
|
|
22
|
+
hash: '9673d0722a7675b9b8d11f90849d9b44',
|
|
23
|
+
images: [
|
|
24
|
+
{ width: 336, viewSize: 1024 },
|
|
25
|
+
{ width: 336, viewSize: 768 },
|
|
26
|
+
{ width: 416, viewSize: 480 },
|
|
27
|
+
{ width: 374, viewSize: 414 },
|
|
28
|
+
{ width: 335, viewSize: 375 },
|
|
29
|
+
{ width: 300 },
|
|
30
|
+
],
|
|
31
|
+
photoPath: 'https://www-kiva-org.freetls.fastly.net/img/',
|
|
32
|
+
defaultImage: { width: 300 },
|
|
33
|
+
percentage: 45,
|
|
34
|
+
showVoteButton: true,
|
|
35
|
+
};
|