Files

41 lines
1.0 KiB
Svelte
Raw Permalink Normal View History

2024-08-15 22:11:26 +03:00
<script>
import Icon from "../../common/Icon.svelte";
2026-05-14 22:49:47 +03:00
import { createEventDispatcher } from "svelte";
2024-08-15 22:11:26 +03:00
import Preview from "../../files/Preview.svelte";
const dispatch = createEventDispatcher();
2026-05-14 22:49:47 +03:00
2026-05-06 18:11:42 +03:00
export let file;
2024-08-15 22:11:26 +03:00
export let hasDelete = false;
function remove(e) {
e.preventDefault();
2026-05-06 18:11:42 +03:00
dispatch("remove_file", file.id);
2024-08-15 22:11:26 +03:00
}
</script>
<div class="preview-file">
2024-08-16 14:34:39 +03:00
<div style="display: flex;align-items: center;gap: 10px;">
<div class="image">
2026-05-06 18:11:42 +03:00
<Preview {file} size="small" />
2024-08-15 22:11:26 +03:00
</div>
2024-08-16 14:34:39 +03:00
<div class="title">
<div>
2026-05-06 18:11:42 +03:00
{file.filename}
2024-08-16 14:34:39 +03:00
</div>
</div>
2024-08-15 22:11:26 +03:00
</div>
2026-05-06 18:11:42 +03:00
<div
style="display: flex;gap:4px; align-items: center; margin-right: 10px;"
>
2024-08-18 17:23:18 +03:00
{#if hasDelete}
<div class="reference-action">
2026-05-06 18:11:42 +03:00
<button class="button" on:click={remove}>
<Icon icon="trash-can" />
2024-08-18 17:23:18 +03:00
</button>
</div>
{/if}
</div>
2024-08-15 22:11:26 +03:00
</div>