@kiva/kv-components 3.48.3 → 3.49.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 +24 -0
- package/package.json +2 -2
- package/vue/KvVotingCard.vue +154 -0
- package/vue/stories/KvVotingCard.stories.js +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.49.0...@kiva/kv-components@3.49.1) (2024-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* correcting mistake with wrong function call ([904d39d](https://github.com/kiva/kv-ui-elements/commit/904d39df4afa9d470fc91a96d7e76fe782898448))
|
|
12
|
+
* editing classes for country / name tag ([aaac1c5](https://github.com/kiva/kv-ui-elements/commit/aaac1c561a24a192031977c7ea5a365789228740))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [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)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* vote button variant ([d58fe0c](https://github.com/kiva/kv-ui-elements/commit/d58fe0c9d16b3139d36e7d61bc2c3b4fbb5d1f0d))
|
|
24
|
+
* voting category cards ([8938dff](https://github.com/kiva/kv-ui-elements/commit/8938dff740c79eaf09e8543ad384c97decee2634))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [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)
|
|
7
31
|
|
|
8
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.49.1",
|
|
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": "189e36f37bd09e01f11d65347e24feafbbba7324"
|
|
79
79
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
<div
|
|
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 tw-truncate"
|
|
40
|
+
:icon="mapMarkerIcon"
|
|
41
|
+
/>
|
|
42
|
+
<div>
|
|
43
|
+
{{ borrowerName }}, {{ country }}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<h3 class="tw-font-medium">
|
|
49
|
+
{{ category }}
|
|
50
|
+
</h3>
|
|
51
|
+
<div class="tw-flex tw-items-center tw-w-full tw-mb-1">
|
|
52
|
+
<kv-progress-bar
|
|
53
|
+
class="tw-flex-grow"
|
|
54
|
+
:aria-label="'Percent of votes for ' + category"
|
|
55
|
+
:value="percentage"
|
|
56
|
+
/>
|
|
57
|
+
<div class="tw-ml-2 tw-font-medium">
|
|
58
|
+
{{ percentage }}%
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<kv-button
|
|
62
|
+
v-if="showVoteButton"
|
|
63
|
+
class="tw-w-full"
|
|
64
|
+
@click="castVote"
|
|
65
|
+
>
|
|
66
|
+
Vote
|
|
67
|
+
</kv-button>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script>
|
|
72
|
+
import { mdiMapMarker } from '@mdi/js';
|
|
73
|
+
import {
|
|
74
|
+
computed,
|
|
75
|
+
} from 'vue-demi';
|
|
76
|
+
import KvBorrowerImage from './KvBorrowerImage.vue';
|
|
77
|
+
import KvProgressBar from './KvProgressBar.vue';
|
|
78
|
+
import KvButton from './KvButton.vue';
|
|
79
|
+
import KvMaterialIcon from './KvMaterialIcon.vue';
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
name: 'KvVotingCard',
|
|
83
|
+
components: {
|
|
84
|
+
KvBorrowerImage,
|
|
85
|
+
KvProgressBar,
|
|
86
|
+
KvButton,
|
|
87
|
+
KvMaterialIcon,
|
|
88
|
+
},
|
|
89
|
+
props: {
|
|
90
|
+
borrowerName: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: '',
|
|
93
|
+
},
|
|
94
|
+
country: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: '',
|
|
97
|
+
},
|
|
98
|
+
category: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: '',
|
|
101
|
+
},
|
|
102
|
+
aspectRatio: {
|
|
103
|
+
type: Number,
|
|
104
|
+
default: 1,
|
|
105
|
+
},
|
|
106
|
+
hash: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: '',
|
|
109
|
+
},
|
|
110
|
+
images: {
|
|
111
|
+
type: Array,
|
|
112
|
+
default: () => [],
|
|
113
|
+
},
|
|
114
|
+
photoPath: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: '',
|
|
117
|
+
},
|
|
118
|
+
defaultImage: {
|
|
119
|
+
type: Object,
|
|
120
|
+
default: () => ({ width: 300 }),
|
|
121
|
+
},
|
|
122
|
+
percentage: {
|
|
123
|
+
type: Number,
|
|
124
|
+
default: 0,
|
|
125
|
+
},
|
|
126
|
+
showVoteButton: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: true,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
emits: ['vote'],
|
|
132
|
+
setup() {
|
|
133
|
+
const mapMarkerIcon = computed(() => {
|
|
134
|
+
return mdiMapMarker;
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
mapMarkerIcon,
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
methods: {
|
|
141
|
+
castVote() {
|
|
142
|
+
this.$emit('vote', {
|
|
143
|
+
category: this.category,
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style scoped>
|
|
151
|
+
.kv-voting-card {
|
|
152
|
+
max-width: 300px;
|
|
153
|
+
}
|
|
154
|
+
</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
|
+
};
|