mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-13 22:39:15 +00:00
UI updates for item card
This commit is contained in:
parent
149f16a600
commit
d26118a515
7 changed files with 126 additions and 101 deletions
|
@ -1,43 +1,42 @@
|
|||
<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 p-4 gap-3">
|
||||
<h2 class="card-title">
|
||||
{{ item.name }}
|
||||
<Icon v-if="item.archived" class="ml-auto" name="mdi-archive-outline" />
|
||||
<Icon v-else class="ml-auto" name="mdi-package-variant" />
|
||||
</h2>
|
||||
<div v-if="colOne" class="flex gap-x-2 items-center justify-between">
|
||||
<NuxtLink
|
||||
v-if="item.location"
|
||||
class="badge badge-primary group-hover:badge-ghost"
|
||||
:to="`/location/${item.location.id}`"
|
||||
>
|
||||
<Icon name="heroicons-map-pin" class="mr-2 swap-on"></Icon>
|
||||
<NuxtLink class="group card rounded-md" :to="`/item/${item.id}`">
|
||||
<div class="rounded-t flex flex-col bg-neutral text-neutral-content p-5">
|
||||
<h2 class="text-base mb-4 last:mb-0 font-bold two-line min-h-[48px]">{{ item.name }}</h2>
|
||||
<NuxtLink
|
||||
v-if="item.location"
|
||||
class="inline-flex text-sm items-center hover:link"
|
||||
:to="`/location/${item.location.id}`"
|
||||
>
|
||||
<Icon name="heroicons-map-pin" class="mr-1 h-4 w-4"></Icon>
|
||||
<span>
|
||||
{{ item.location.name }}
|
||||
</NuxtLink>
|
||||
<div class="flex gap-2 ml-auto items-end">
|
||||
<div v-if="item.purchasePrice" class="tooltip" data-tip="Purchase Price">
|
||||
<span class="badge badge-ghost">
|
||||
<Currency :amount="item.purchasePrice" />
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="item.insured" class="tooltip" data-tip="Insured">
|
||||
<Icon class="h-5 w-5 text-base-200" name="mdi-shield-check" />
|
||||
</div>
|
||||
<div v-if="item.quantity > 1" class="tooltip" data-tip="Quantity">
|
||||
<span class="badge badge-ghost">
|
||||
{{ item.quantity }}
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<div class="rounded-b p-4 flex-grow col-span-4 flex flex-col gap-y-2 bg-base-100">
|
||||
<div class="flex justify-between gap-2">
|
||||
<div class="mr-auto tooltip" data-tip="Purchase Price">
|
||||
<span class="badge badge-sm badge-ghost h-5">
|
||||
<Currency :amount="item.purchasePrice" />
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="item.createdAt" class="tooltip z-10" :data-tip="datetime">
|
||||
<Icon class="h-5 w-5 text-primary" name="mdi-calendar" />
|
||||
</div>
|
||||
<div v-if="item.insured" class="tooltip z-10" data-tip="Insured">
|
||||
<Icon class="h-5 w-5 text-primary" name="mdi-shield-check" />
|
||||
</div>
|
||||
<div v-if="item.quantity > 1" class="tooltip" data-tip="Quantity">
|
||||
<span class="badge h-5 w-5 badge-primary badge-sm text-xs">
|
||||
{{ item.quantity }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
class="w-[100%] group-hover:bg-neutral-content h-[3px] transition-colors duration-300 rounded-box bg-primary"
|
||||
></span>
|
||||
<div class="flex gap-2 flex-wrap justify-end">
|
||||
<p class="mb-2 text-clip three-line">
|
||||
{{ item.description }}
|
||||
</p>
|
||||
|
||||
<div class="flex gap-2 flex-wrap -mr-1 mt-auto justify-end">
|
||||
<LabelChip v-for="label in top3" :key="label.id" :label="label" size="sm" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -47,14 +46,14 @@
|
|||
<script setup lang="ts">
|
||||
import { ItemOut, ItemSummary } from "~~/lib/api/types/data-contracts";
|
||||
|
||||
const colOne = computed(() => {
|
||||
return props.item.location || props.item.purchasePrice;
|
||||
});
|
||||
|
||||
const top3 = computed(() => {
|
||||
return props.item.labels.slice(0, 3) || [];
|
||||
});
|
||||
|
||||
const datetime = computed(() => {
|
||||
return "Created " + fmtDate(props.item.createdAt, "human");
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object as () => ItemOut | ItemSummary,
|
||||
|
@ -62,3 +61,23 @@
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="css">
|
||||
.three-line {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.two-line {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue