Files
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

43 lines
842 B
Vue

<template>
<div
class="badge-counter"
:class="{ 'badge-counter--one-digit': hasOneDigitOnly }"
>
{{ value }}
</div>
</template>
<script>
export default {
name: 'BadgeCounter',
props: {
/**
* The number to display in the badge
*/
count: {
type: Number,
default: 1,
},
/**
* The maximum number to display in the badge.
* If the count value is higher the badge will display the limit value minus one with a plus sign.
*/
limit: {
type: Number,
required: false,
default: 10,
},
},
computed: {
value() {
if (this.count > 1 && this.limit > 1 && this.count >= this.limit)
return `${this.limit - 1}+`
return this.count
},
hasOneDigitOnly() {
return this.value.toString().length < 2
},
},
}
</script>