2024-10-04 04:05:55 +00:00
|
|
|
<script lang="ts">
|
2024-10-04 04:31:42 +00:00
|
|
|
import { createEventDispatcher } from 'svelte';
|
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
|
2024-10-04 04:05:55 +00:00
|
|
|
import FileItem from '$lib/components/common/FileItem.svelte';
|
|
|
|
|
|
2024-10-04 04:31:42 +00:00
|
|
|
export let selectedFileId = null;
|
2024-10-04 04:05:55 +00:00
|
|
|
export let files = [];
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class=" max-h-full flex flex-col w-full">
|
|
|
|
|
{#each files as file (file.id)}
|
|
|
|
|
<div class="mt-2 px-2">
|
|
|
|
|
<FileItem
|
|
|
|
|
className="w-full"
|
2024-10-04 04:31:42 +00:00
|
|
|
colorClassName="{selectedFileId === file.id
|
|
|
|
|
? 'bg-gray-850'
|
|
|
|
|
: 'bg-transparent'} hover:bg-gray-50 dark:hover:bg-gray-850 transition"
|
2024-10-04 04:05:55 +00:00
|
|
|
{file}
|
|
|
|
|
name={file.meta.name}
|
|
|
|
|
type="file"
|
|
|
|
|
dismissible
|
2024-10-04 04:31:42 +00:00
|
|
|
on:click={() => {
|
|
|
|
|
dispatch('click', file.id);
|
|
|
|
|
}}
|
|
|
|
|
on:dismiss={() => {
|
|
|
|
|
dispatch('delete', file.id);
|
|
|
|
|
}}
|
2024-10-04 04:05:55 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|