Line data Source code
1 : <template>
2 2102 : <div class="flex h-full shrink-0 items-center">
3 2 : <TopbarBadge
4 : v-for="badge in topbarBadgeStore.badges"
5 : :key="badge.text"
6 : :badge
7 : :display-mode="displayMode"
8 : :reverse-order="reverseOrder"
9 : :no-padding="noPadding"
10 : />
11 : </div>
12 : </template>
13 :
14 : <script lang="ts" setup>
15 : import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
16 : import { computed } from 'vue'
17 :
18 : import { useTopbarBadgeStore } from '@/stores/topbarBadgeStore'
19 :
20 : import TopbarBadge from './TopbarBadge.vue'
21 :
22 : const { reverseOrder, noPadding } = defineProps<{
23 : reverseOrder?: boolean
24 : noPadding?: boolean
25 : }>()
26 :
27 2021 : const breakpoints = useBreakpoints(breakpointsTailwind)
28 2021 : const isXl = breakpoints.greaterOrEqual('xl')
29 2021 : const isLg = breakpoints.greaterOrEqual('lg')
30 :
31 2021 : const displayMode = computed<'full' | 'compact' | 'icon-only'>(() => {
32 2 : if (isXl.value) return 'full'
33 2 : if (isLg.value) return 'compact'
34 1 : return 'icon-only'
35 : })
36 :
37 2021 : const topbarBadgeStore = useTopbarBadgeStore()
38 : </script>
|