forked from mirrors/homebox
refactor: refactor item page UI (#235)
* fix generated types * fix tailwind auto-complete * force lowercase buttons * add title and change style for items page * add copy button support for item details * empty state for log * fix duplicate padding * add option for create without closing the current dialog. * hide purchase price is not set * invert toggle for edit mode * update styles on item cards * add edit support for maintenance logs
This commit is contained in:
parent
c19fe94c08
commit
91d0c588d9
13 changed files with 197 additions and 68 deletions
|
@ -1,13 +1,27 @@
|
|||
<template>
|
||||
<button class="btn btn-outline btn-square btn-sm" @click="copyText">
|
||||
<button class="" @click="copyText">
|
||||
<label
|
||||
class="swap swap-rotate"
|
||||
:class="{
|
||||
'swap-active': copied,
|
||||
}"
|
||||
>
|
||||
<Icon class="swap-off h-5 w-5" name="mdi-content-copy" />
|
||||
<Icon class="swap-on h-5 w-5" name="mdi-clipboard" />
|
||||
<Icon
|
||||
class="swap-off"
|
||||
name="mdi-content-copy"
|
||||
:style="{
|
||||
height: `${iconSize}px`,
|
||||
width: `${iconSize}px`,
|
||||
}"
|
||||
/>
|
||||
<Icon
|
||||
class="swap-on"
|
||||
name="mdi-clipboard"
|
||||
:style="{
|
||||
height: `${iconSize}px`,
|
||||
width: `${iconSize}px`,
|
||||
}"
|
||||
/>
|
||||
</label>
|
||||
</button>
|
||||
</template>
|
||||
|
@ -18,6 +32,10 @@
|
|||
type: String as () => string,
|
||||
default: "",
|
||||
},
|
||||
iconSize: {
|
||||
type: Number as () => number,
|
||||
default: 20,
|
||||
},
|
||||
});
|
||||
|
||||
const copied = ref(false);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="border-t border-gray-300 px-4 py-5 sm:p-0">
|
||||
<dl class="sm:divide-y sm:divide-gray-300">
|
||||
<div v-for="(detail, i) in details" :key="i" class="py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<div v-for="(detail, i) in details" :key="i" class="py-4 sm:grid group sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm font-medium text-base-content">
|
||||
{{ detail.name }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm text-base-content sm:col-span-2 sm:mt-0">
|
||||
<dd class="text-sm text-base-content text-start sm:col-span-2">
|
||||
<slot :name="detail.slot || detail.name" v-bind="{ detail }">
|
||||
<DateTime v-if="detail.type == 'date'" :date="detail.text" />
|
||||
<Currency v-else-if="detail.type == 'currency'" :amount="detail.text" />
|
||||
|
@ -23,7 +23,15 @@
|
|||
</ClientOnly>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ detail.text }}
|
||||
<span class="flex items-center">
|
||||
{{ detail.text }}
|
||||
<span
|
||||
v-if="detail.copyable"
|
||||
class="opacity-0 group-hover:opacity-100 ml-4 my-0 duration-75 transition-opacity"
|
||||
>
|
||||
<CopyText :text="detail.text.toString()" :icon-size="16" class="btn btn-xs btn-ghost btn-circle" />
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
</slot>
|
||||
</dd>
|
||||
|
|
|
@ -29,6 +29,7 @@ type MarkdownDetail = BaseDetail & {
|
|||
export type Detail = BaseDetail & {
|
||||
text: StringLike;
|
||||
type?: "text";
|
||||
copyable?: boolean;
|
||||
};
|
||||
|
||||
export type AnyDetail = DateDetail | CurrencyDetail | LinkDetail | MarkdownDetail | Detail;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue