This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import AttachmentPreview from '$lib/components/AttachmentPreview.svelte';
|
||||
import Button from '$lib/components/ui/button.svelte';
|
||||
import type { AttachmentLocation, SubDocument, ZipAttachment } from '$lib/zip-processing';
|
||||
import { cn } from '$lib/utils';
|
||||
|
||||
@@ -16,6 +17,9 @@
|
||||
onBlockDragOver?: (blockIndex: number, event: DragEvent) => void;
|
||||
onBlockDrop?: (blockIndex: number, event: DragEvent) => void;
|
||||
onBlockDragEnd?: () => void;
|
||||
onDownload?: () => void;
|
||||
isDownloading?: boolean;
|
||||
downloadDisabled?: boolean;
|
||||
};
|
||||
|
||||
let {
|
||||
@@ -30,7 +34,10 @@
|
||||
onBlockDragStart = () => {},
|
||||
onBlockDragOver = () => {},
|
||||
onBlockDrop = () => {},
|
||||
onBlockDragEnd = () => {}
|
||||
onBlockDragEnd = () => {},
|
||||
onDownload,
|
||||
isDownloading = false,
|
||||
downloadDisabled = false
|
||||
}: Props = $props();
|
||||
|
||||
let subDocumentName = $state('');
|
||||
@@ -200,6 +207,19 @@
|
||||
{attachments.length} Datei{attachments.length === 1 ? '' : 'en'}
|
||||
</span>
|
||||
|
||||
{#if onDownload}
|
||||
<Button
|
||||
type="button"
|
||||
variant="bordered"
|
||||
disabled={downloadDisabled || isDownloading || attachments.length === 0}
|
||||
onclick={onDownload}
|
||||
draggable="false"
|
||||
aria-label={`PDF für ${subDocumentName} herunterladen`}
|
||||
>
|
||||
{isDownloading ? 'PDF wird erstellt' : 'PDF herunterladen'}
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
class="rounded-md border border-primary-200 bg-white px-2 py-1 text-[13px] font-medium text-primary-700 transition hover:border-red-300 hover:bg-red-50 hover:text-red-700"
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user