@kiva/kv-components 3.58.0 → 3.59.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 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.59.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.59.0...@kiva/kv-components@3.59.1) (2024-03-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * comments count fixed ([#360](https://github.com/kiva/kv-ui-elements/issues/360)) ([cdbaf2d](https://github.com/kiva/kv-ui-elements/commit/cdbaf2d6e19e556cfb769805307466c24021567e))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.59.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.58.0...@kiva/kv-components@3.59.0) (2024-03-04)
18
+
19
+
20
+ ### Features
21
+
22
+ * replies count added to reply commenting button ([#359](https://github.com/kiva/kv-ui-elements/issues/359)) ([87e4b01](https://github.com/kiva/kv-ui-elements/commit/87e4b01022641e774203274a0b3a353d1b2a37bc))
23
+
24
+
25
+
26
+
27
+
6
28
  # [3.58.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.57.0...@kiva/kv-components@3.58.0) (2024-03-01)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.58.0",
3
+ "version": "3.59.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": "b2375c3684b25f0b94ed8cda48e2871564467ce4"
78
+ "gitHead": "eaefca5854f506ac1cd70d1e70ef6a836396416a"
79
79
  }
@@ -12,6 +12,14 @@ describe('KvCommentsReplyButton', () => {
12
12
  expect(replyButton).toBeDefined();
13
13
  });
14
14
 
15
+ it('should render number of replies', () => {
16
+ const { getByTestId } = render(KvCommentsReplyButton, { props: { numberOfReplies: 6 } });
17
+ const replyCount = getByTestId('reply-count');
18
+
19
+ expect(replyCount).toBeDefined();
20
+ expect(replyCount).toHaveTextContent(6);
21
+ });
22
+
15
23
  it('should emit click event when clicked', async () => {
16
24
  const { getByRole, emitted } = render(KvCommentsReplyButton);
17
25
  const replyButton = getByRole('button', { name: 'Reply' });
@@ -40,11 +40,13 @@
40
40
  <p
41
41
  v-if="numberOfLikes"
42
42
  data-testid="like-count"
43
+ class="tw-font-medium"
43
44
  >
44
45
  {{ numberOfLikes }}
45
46
  </p>
46
47
  </div>
47
48
  <kv-comments-reply-button
49
+ :number-of-replies="numberOfReplies"
48
50
  @click="replyClick"
49
51
  />
50
52
  </div>
@@ -188,6 +190,8 @@ export default {
188
190
 
189
191
  const numberOfLikes = computed(() => comment?.value?.children_counts?.like ?? 0);
190
192
 
193
+ const numberOfReplies = computed(() => comment?.value?.children_counts?.comment ?? 0);
194
+
191
195
  return {
192
196
  hideInput,
193
197
  showInput,
@@ -203,6 +207,7 @@ export default {
203
207
  childComments,
204
208
  isLiked,
205
209
  numberOfLikes,
210
+ numberOfReplies,
206
211
  };
207
212
  },
208
213
  };
@@ -17,7 +17,12 @@
17
17
  fill="#1C1B1F"
18
18
  />
19
19
  </svg>
20
-
20
+ <span
21
+ v-if="numberOfReplies"
22
+ data-testid="reply-count"
23
+ >
24
+ {{ numberOfReplies }}
25
+ </span>
21
26
  <span>
22
27
  Reply
23
28
  </span>
@@ -27,6 +32,15 @@
27
32
  <script>
28
33
  export default {
29
34
  name: 'KvCommentsReplyButton',
35
+ props: {
36
+ /**
37
+ * The number of replies to the comment.
38
+ */
39
+ numberOfReplies: {
40
+ type: Number,
41
+ default: 0,
42
+ },
43
+ },
30
44
  emits: [
31
45
  'click',
32
46
  ],
@@ -0,0 +1,23 @@
1
+ import KvCommentsReplyButton from '../KvCommentsReplyButton.vue';
2
+
3
+ export default {
4
+ title: 'KvCommentsReplyButton',
5
+ component: KvCommentsReplyButton,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (templateArgs, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvCommentsReplyButton },
12
+ setup() { return { args: templateArgs }; },
13
+ template: `
14
+ <KvCommentsReplyButton v-bind="args" />
15
+ `,
16
+ });
17
+ template.args = args;
18
+ return template;
19
+ };
20
+
21
+ export const Default = story({});
22
+
23
+ export const ReplyCount = story({ numberOfReplies: 6 });