homebox/frontend/components/Item/Card.vue

37 lines
914 B
Vue
Raw Normal View History

2022-09-03 09:17:57 +00:00
<template>
<NuxtLink
class="group card bg-neutral text-neutral-content hover:bg-primary transition-colors duration-300"
:to="`/item/${item.id}`"
>
<div class="card-body py-4 px-6">
<h2 class="card-title">
<Icon name="mdi-package-variant" />
{{ item.name }}
</h2>
2022-09-06 18:32:13 +00:00
<p>{{ description }}</p>
2022-09-03 09:17:57 +00:00
<div class="flex gap-2 flex-wrap justify-end">
<LabelChip
v-for="label in item.labels"
:key="label.id"
:label="label"
class="badge-primary group-hover:badge-secondary"
/>
2022-09-03 09:17:57 +00:00
</div>
</div>
</NuxtLink>
</template>
<script setup lang="ts">
import { Item } from "~~/lib/api/classes/items";
2022-09-03 09:17:57 +00:00
2022-09-06 18:32:13 +00:00
const props = defineProps({
2022-09-03 09:17:57 +00:00
item: {
type: Object as () => Item,
required: true,
},
});
2022-09-06 18:32:13 +00:00
const description = computed(() => {
return truncate(props.item.description, 80);
});
2022-09-03 09:17:57 +00:00
</script>