From a7564303e802d0800042a6ca9508f8467954ce8f 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 | 257 ++++++++++++++++-- .../NcCounterBubble/NcCounterBubble.spec.js | 68 +++++ 2 files changed, 306 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..d06953247f 100644 --- a/src/components/NcCounterBubble/NcCounterBubble.vue +++ b/src/components/NcCounterBubble/NcCounterBubble.vue @@ -3,36 +3,186 @@ - 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 + + +``` + + +