From c6d9c5bf5b37e1399973a6c7d184c7d46ed68db9 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 24 Jul 2024 15:15:42 +0200 Subject: [PATCH] feat(NcCounterBubble): add count prop and humanize output Signed-off-by: Grigorii K. Shartsev --- .../NcCounterBubble/NcCounterBubble.vue | 260 ++++++++++++++++-- .../NcCounterBubble/NcCounterBubble.spec.js | 68 +++++ 2 files changed, 309 insertions(+), 19 deletions(-) create mode 100644 tests/unit/components/NcCounterBubble/NcCounterBubble.spec.js diff --git a/src/components/NcCounterBubble/NcCounterBubble.vue b/src/components/NcCounterBubble/NcCounterBubble.vue index 49e791a607..4cbdda9c91 100644 --- a/src/components/NcCounterBubble/NcCounterBubble.vue +++ b/src/components/NcCounterBubble/NcCounterBubble.vue @@ -3,36 +3,187 @@ - SPDX-License-Identifier: AGPL-3.0-or-later --> - + -### Normal Counter +### Default usage -``` -314+ -``` +NcCounterBubble displays a number from the `count` prop in a bubble. -### Outlined Counter (e.g team mentions) +By default, the number is **humanized** according to Nextcloud user's locale setting. Humanization can be disabled via `raw` prop. -``` -314+ +```vue + + + + + ``` -### Highlighted Counter (e.g direct mentions) +### Styles + +Use different styles for different types of counters. ``` -314+ + + + ``` - +### Custom content (deprecated) + +You can use the default slot to pass any custom content. If you pass a plain number to the default slot, without raw prop it will be humanized like via `count` prop. +**DEPRECATED:** passing count via slot content is **deprecated** and will be removed in the v9. Prefer using `count` prop for numbers or [NcChip](#/Components/NcChip) component for a custom content. + +```vue + + +``` + + +