@kiva/kv-components 3.103.0 → 3.105.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/KvVotingCardV2.vue +73 -30
- package/vue/stories/KvVotingCardV2.stories.js +59 -3
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.105.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.104.0...@kiva/kv-components@3.105.0) (2024-10-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* vote card read more ([b7d2c74](https://github.com/kiva/kv-ui-elements/commit/b7d2c74dfa6c464e68b3a6a52298a4a37b11d184))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.104.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.103.0...@kiva/kv-components@3.104.0) (2024-10-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* vertically align contents inside voting cards 2 to bottom ([828e24d](https://github.com/kiva/kv-ui-elements/commit/828e24dd12b40674fd2f5079b2741ebf0e014c03))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.103.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.5...@kiva/kv-components@3.103.0) (2024-10-08)
|
|
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.105.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"optional": true
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "1e9645f3136ca83e1768fab93e3e97e636fa29e7"
|
|
87
87
|
}
|
package/vue/KvVotingCardV2.vue
CHANGED
|
@@ -1,53 +1,79 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="vote_card"
|
|
3
|
+
class="vote_card tw-flex tw-flex-col tw-justify-end"
|
|
4
4
|
:style="cssProps"
|
|
5
5
|
>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
<div
|
|
7
|
+
class="tw-flex-grow-0 tw-text-white"
|
|
8
|
+
>
|
|
9
|
+
<h2 class="tw-italic tw-pb-1">
|
|
10
|
+
{{ title }}
|
|
11
|
+
</h2>
|
|
12
|
+
<p class="tw-pb-1.5">
|
|
13
|
+
{{ truncatedDescription }}
|
|
14
|
+
<a
|
|
15
|
+
v-if="isTruncated"
|
|
16
|
+
class="tw-underline tw-pl-1 tw-text-white tw-cursor-pointer"
|
|
17
|
+
@click="isLightboxOpen = true"
|
|
18
|
+
>read more</a>
|
|
19
|
+
</p>
|
|
20
|
+
<div class="tw-block md:tw-flex tw-justify-between">
|
|
21
|
+
<div
|
|
22
|
+
v-if="showPercentage"
|
|
23
|
+
class="tw-flex tw-items-center tw-w-full tw-max-w-16"
|
|
24
|
+
>
|
|
25
|
+
<kv-progress-bar
|
|
26
|
+
class="tw-flex-grow"
|
|
27
|
+
:aria-label="'Percent of votes for ' + description"
|
|
28
|
+
:value="percentage"
|
|
29
|
+
/>
|
|
30
|
+
<div class="tw-ml-2">
|
|
31
|
+
{{ percentage }}%
|
|
32
|
+
</div>
|
|
24
33
|
</div>
|
|
34
|
+
<kv-button
|
|
35
|
+
v-if="showVoteButton"
|
|
36
|
+
variant="secondary"
|
|
37
|
+
class="tw-flex-grow-0 tw-min-w-16 tw-mt-2"
|
|
38
|
+
@click="castVote"
|
|
39
|
+
>
|
|
40
|
+
Vote
|
|
41
|
+
</kv-button>
|
|
25
42
|
</div>
|
|
26
|
-
<kv-button
|
|
27
|
-
v-if="showVoteButton"
|
|
28
|
-
variant="secondary"
|
|
29
|
-
class="tw-flex-grow-0 tw-min-w-16 tw-mt-2"
|
|
30
|
-
@click="castVote"
|
|
31
|
-
>
|
|
32
|
-
Vote
|
|
33
|
-
</kv-button>
|
|
34
43
|
</div>
|
|
44
|
+
<KvLightbox
|
|
45
|
+
:title="title"
|
|
46
|
+
:visible="isLightboxOpen"
|
|
47
|
+
@lightbox-closed="isLightboxOpen = false"
|
|
48
|
+
>
|
|
49
|
+
<template #header>
|
|
50
|
+
<h3>
|
|
51
|
+
{{ title }}
|
|
52
|
+
</h3>
|
|
53
|
+
</template>
|
|
54
|
+
<p class="tw-pb-1.5">
|
|
55
|
+
{{ description }}
|
|
56
|
+
</p>
|
|
57
|
+
</KvLightbox>
|
|
35
58
|
</div>
|
|
36
59
|
</template>
|
|
37
60
|
|
|
38
61
|
<script>
|
|
39
62
|
import {
|
|
40
63
|
computed,
|
|
64
|
+
ref,
|
|
41
65
|
toRefs,
|
|
42
66
|
} from 'vue-demi';
|
|
43
67
|
import KvProgressBar from './KvProgressBar.vue';
|
|
44
68
|
import KvButton from './KvButton.vue';
|
|
69
|
+
import KvLightbox from './KvLightbox.vue';
|
|
45
70
|
|
|
46
71
|
export default {
|
|
47
72
|
name: 'KvVotingCard',
|
|
48
73
|
components: {
|
|
49
|
-
KvProgressBar,
|
|
50
74
|
KvButton,
|
|
75
|
+
KvLightbox,
|
|
76
|
+
KvProgressBar,
|
|
51
77
|
},
|
|
52
78
|
props: {
|
|
53
79
|
title: {
|
|
@@ -79,8 +105,13 @@ export default {
|
|
|
79
105
|
'vote',
|
|
80
106
|
],
|
|
81
107
|
setup(props, { emit }) {
|
|
108
|
+
const isLightboxOpen = ref(false);
|
|
109
|
+
|
|
110
|
+
const TRUNCATION_LIMIT = 110;
|
|
111
|
+
|
|
82
112
|
const {
|
|
83
113
|
backgroundImageUrl,
|
|
114
|
+
description,
|
|
84
115
|
} = toRefs(props);
|
|
85
116
|
|
|
86
117
|
const cssProps = computed(() => {
|
|
@@ -89,11 +120,24 @@ export default {
|
|
|
89
120
|
};
|
|
90
121
|
});
|
|
91
122
|
|
|
123
|
+
const isTruncated = computed(() => {
|
|
124
|
+
return description?.value && (description?.value.length > TRUNCATION_LIMIT);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const truncatedDescription = computed(() => {
|
|
128
|
+
if (isTruncated.value) {
|
|
129
|
+
return `${description.value.substring(0, TRUNCATION_LIMIT)}...`;
|
|
130
|
+
}
|
|
131
|
+
return description.value;
|
|
132
|
+
});
|
|
92
133
|
return {
|
|
93
134
|
cssProps,
|
|
94
135
|
castVote() {
|
|
95
136
|
emit('vote');
|
|
96
137
|
},
|
|
138
|
+
isLightboxOpen,
|
|
139
|
+
isTruncated,
|
|
140
|
+
truncatedDescription,
|
|
97
141
|
};
|
|
98
142
|
},
|
|
99
143
|
};
|
|
@@ -105,7 +149,6 @@ export default {
|
|
|
105
149
|
linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 1) 100%),
|
|
106
150
|
var(--background-image-voting-card);
|
|
107
151
|
background-size: cover;
|
|
108
|
-
|
|
109
|
-
@apply tw-rounded tw-px-4 tw-pb-4 tw-text-white;
|
|
152
|
+
@apply tw-rounded tw-px-4 tw-pb-4;
|
|
110
153
|
}
|
|
111
154
|
</style>
|
|
@@ -5,13 +5,13 @@ export default {
|
|
|
5
5
|
component: KvVotingCardV2,
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const TemplateDefault = (args) => ({
|
|
9
9
|
components: { KvVotingCardV2 },
|
|
10
10
|
setup() {
|
|
11
11
|
return { args };
|
|
12
12
|
},
|
|
13
13
|
template: `
|
|
14
|
-
<div
|
|
14
|
+
<div>
|
|
15
15
|
<kv-voting-card-v2 v-bind="args" @vote="vote"/>
|
|
16
16
|
</div>
|
|
17
17
|
`,
|
|
@@ -22,7 +22,61 @@ const Template = (args) => ({
|
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const TemplateMultiple = () => ({
|
|
26
|
+
components: { KvVotingCardV2 },
|
|
27
|
+
setup() {
|
|
28
|
+
const args1 = {
|
|
29
|
+
title: 'Women owned small businesses',
|
|
30
|
+
description: 'Just half of all women-owned businesses in the U.S. who apply for a loan are approved. Kiva provides access where others don\'t, creating more opportunities for women entrepreneurs.',
|
|
31
|
+
backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/2l422gpfOYHz02yy3V1Qey/12e64dbe0690fb2f12e0d95f6321f6d1/Jacqueline-Rwanda.jpg',
|
|
32
|
+
percentage: 45,
|
|
33
|
+
showVoteButton: true,
|
|
34
|
+
showPercentage: true,
|
|
35
|
+
};
|
|
36
|
+
const args2 = {
|
|
37
|
+
title: 'BIPOC-owned small businesses',
|
|
38
|
+
description: 'Small businesses create more opportunities for women entrepreneurs.',
|
|
39
|
+
backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/3LZLziZYCl05YAhb6zlH6G/df770c45b790f065b8f3d11744ef1417/Lola__Oregon__United_States.jpeg',
|
|
40
|
+
percentage: 45,
|
|
41
|
+
showVoteButton: true,
|
|
42
|
+
showPercentage: true,
|
|
43
|
+
};
|
|
44
|
+
const args3 = {
|
|
45
|
+
title: 'Early-stage small businesses',
|
|
46
|
+
description: 'Local shops are the heartbeat of our communities — but only 80% of these businesses survive their first year. When you support U.S. small businesses, youre helping to create employment opportunities and stimulate local economies.',
|
|
47
|
+
backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/65YeFWuXaomM61E8PYasqp/0594e95be96cb8eac86b9ebc26bd684d/Natasha__California__United_States_sm.jpeg',
|
|
48
|
+
percentage: 45,
|
|
49
|
+
showVoteButton: true,
|
|
50
|
+
showPercentage: true,
|
|
51
|
+
};
|
|
52
|
+
const args4 = {
|
|
53
|
+
title: 'Food and retail small businesses',
|
|
54
|
+
description: 'Food and retail businesses are vital contributors to their communities. Sadly they face challenges in getting the financing they need. Loans can help them grow and operate sustainably so they can keep feeding their local neighborhoods.',
|
|
55
|
+
backgroundImageUrl: '//images.ctfassets.net/j0p9a6ql0rn7/2B3wamFMVgJnjuIgMmWCNB/51e4a36aeeb86156f8fe967486c13126/Anna__California__United_States.jpg',
|
|
56
|
+
percentage: 45,
|
|
57
|
+
showVoteButton: true,
|
|
58
|
+
showPercentage: true,
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
args1, args2, args3, args4,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
template: `
|
|
65
|
+
<div class="tw-flex md:tw-flex-wrap" style="max-width: 1200px;">
|
|
66
|
+
<kv-voting-card-v2 v-bind="args1" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
|
|
67
|
+
<kv-voting-card-v2 v-bind="args2" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
|
|
68
|
+
<kv-voting-card-v2 v-bind="args3" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
|
|
69
|
+
<kv-voting-card-v2 v-bind="args4" @vote="vote" style="min-height: 400px;flex-basis: calc(50% - 1.5rem);margin: 0.75rem;"/>
|
|
70
|
+
</div>
|
|
71
|
+
`,
|
|
72
|
+
methods: {
|
|
73
|
+
vote() {
|
|
74
|
+
console.log('vote');
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const Default = TemplateDefault.bind({});
|
|
26
80
|
Default.args = {
|
|
27
81
|
title: 'Women owned small businesses',
|
|
28
82
|
description: 'Just half of all women-owned businesses in the U.S. who apply for a loan are approved. Kiva provides access where others don\'t, creating more opportunities for women entrepreneurs.',
|
|
@@ -31,3 +85,5 @@ Default.args = {
|
|
|
31
85
|
showVoteButton: true,
|
|
32
86
|
showPercentage: true,
|
|
33
87
|
};
|
|
88
|
+
|
|
89
|
+
export const MultipleInGrid = TemplateMultiple.bind({});
|