forked from mirrors/homebox
6a8a25e3f8
* wip: charts.js experimental work * update lock file * wip: frontend redesign * wip: more UI fixes for consistency across themes * cleanup * improve UI log * style updates * fix lint errors
40 lines
1 KiB
Vue
40 lines
1 KiB
Vue
<script setup lang="ts">
|
|
import { LabelOut, LabelSummary } from "~~/lib/api/types/data-contracts";
|
|
|
|
export type sizes = "sm" | "md" | "lg" | "xl";
|
|
defineProps({
|
|
label: {
|
|
type: Object as () => LabelOut | LabelSummary,
|
|
required: true,
|
|
},
|
|
size: {
|
|
type: String as () => sizes,
|
|
default: "md",
|
|
},
|
|
});
|
|
|
|
const badge = ref(null);
|
|
const isHover = useElementHover(badge);
|
|
const { focused } = useFocus(badge);
|
|
|
|
const isActive = computed(() => isHover.value || focused.value);
|
|
</script>
|
|
|
|
<template>
|
|
<NuxtLink
|
|
ref="badge"
|
|
class="badge badge-secondary text-secondary-content"
|
|
:class="{
|
|
'badge-lg p-4': size === 'lg',
|
|
'p-3': size !== 'sm' && size !== 'lg',
|
|
'p-2 badge-sm': size === 'sm',
|
|
}"
|
|
:to="`/label/${label.id}`"
|
|
>
|
|
<label class="swap swap-rotate" :class="isActive ? 'swap-active' : ''">
|
|
<Icon name="heroicons-arrow-right" class="mr-2 swap-on"></Icon>
|
|
<Icon name="heroicons-tag" class="mr-2 swap-off"></Icon>
|
|
</label>
|
|
{{ label.name }}
|
|
</NuxtLink>
|
|
</template>
|