refac: fileItem styling

This commit is contained in:
Timothy J. Baek 2024-10-03 06:45:29 -07:00
parent 15a3c6b171
commit 1c01e52f7c

View File

@ -3,12 +3,14 @@
import { formatFileSize } from '$lib/utils'; import { formatFileSize } from '$lib/utils';
import FileItemModal from './FileItemModal.svelte'; import FileItemModal from './FileItemModal.svelte';
import GarbageBin from '../icons/GarbageBin.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
export let className = 'w-72'; export let className = 'w-60';
export let colorClassName = 'bg-white dark:bg-gray-800'; export let colorClassName =
'bg-white dark:bg-gray-850 border border-gray-50 dark:border-gray-850';
export let url: string | null = null; export let url: string | null = null;
export let dismissible = false; export let dismissible = false;
@ -28,9 +30,8 @@
<FileItemModal bind:show={showModal} bind:file {edit} /> <FileItemModal bind:show={showModal} bind:file {edit} />
{/if} {/if}
<div class="relative group">
<button <button
class="h-14 {className} flex items-center space-x-3 {colorClassName} rounded-xl border border-gray-100 dark:border-gray-800 text-left" class="relative group p-1 {className} flex items-center {colorClassName} rounded-2xl text-left"
type="button" type="button"
on:click={async () => { on:click={async () => {
if (file?.file?.content) { if (file?.file?.content) {
@ -48,7 +49,7 @@
dispatch('click'); dispatch('click');
}} }}
> >
<div class="p-4 py-[1.1rem] bg-red-400 text-white rounded-l-xl"> <div class="p-3 bg-white/10 text-white rounded-xl">
{#if status === 'processed'} {#if status === 'processed'}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -105,7 +106,7 @@
{/if} {/if}
</div> </div>
<div class="flex flex-col justify-center -space-y-0.5 pl-1.5 pr-4 w-full"> <div class="flex flex-col justify-center -space-y-0.5 px-2 w-full">
<div class=" dark:text-gray-100 text-sm font-medium line-clamp-1 mb-1"> <div class=" dark:text-gray-100 text-sm font-medium line-clamp-1 mb-1">
{name} {name}
</div> </div>
@ -125,28 +126,18 @@
{/if} {/if}
</div> </div>
</div> </div>
</button>
{#if dismissible} {#if dismissible}
<div class=" absolute -top-1 -right-1"> <div class=" pr-2">
<button <button
class=" bg-gray-400 text-white border border-white rounded-full group-hover:visible invisible transition" class=" px-2 py-2 dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-white/5 rounded-xl group-hover:visible invisible transition"
type="button" type="button"
on:click={() => { on:click={() => {
dispatch('dismiss'); dispatch('dismiss');
}} }}
> >
<svg <GarbageBin />
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-4 h-4"
>
<path
d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
/>
</svg>
</button> </button>
</div> </div>
{/if} {/if}
</div> </button>