refactor: filesize

This commit is contained in:
EETagent 2022-12-03 21:55:52 +01:00
parent b7a63afba8
commit 09a0329d1d
4 changed files with 6 additions and 6 deletions

View file

@ -17,7 +17,7 @@
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={e => onFileDrop(e.detail)}
title="Motivační dopis" title="Motivační dopis"
filetype="PDF" filetype="PDF"
filesize="10 MB" filesize={10}
fileType={1} fileType={1}
> >
</DashboardUploadCard> </DashboardUploadCard>

View file

@ -14,7 +14,7 @@
export let title: string; export let title: string;
export let filetype: 'PDF' | 'ZIP'; export let filetype: 'PDF' | 'ZIP';
export let filesize: string; export let filesize: number;
export let fileType: number; export let fileType: number;
let fileDropped: boolean = false; let fileDropped: boolean = false;
@ -91,7 +91,7 @@
<div class="flex flex-col sm:flex-row justify-between sm:items-center"> <div class="flex flex-col sm:flex-row justify-between sm:items-center">
<h3 class="mb-4 sm:mb-0">{title}</h3> <h3 class="mb-4 sm:mb-0">{title}</h3>
<div class="mb-4 sm:mb-0 mt-1 sm:mt-0"> <div class="mb-4 sm:mb-0 mt-1 sm:mt-0">
<FileType {filetype} {filesize} /> <FileType {filetype} filesize={filesize + " MB"} />
</div> </div>
<div class="absolute px-7 right-0 top-4"> <div class="absolute px-7 right-0 top-4">
<StatusNotificationDot {status} /> <StatusNotificationDot {status} />
@ -141,7 +141,7 @@
<div class="flex-1 mt-6"> <div class="flex-1 mt-6">
<FileDrop <FileDrop
multiple={false} multiple={false}
maxSize={filetype == 'PDF' ? 10_000_000 : 100_000_000} maxSize={filesize * 1_000_000}
accept={filetype == 'PDF' ? 'application/pdf' : 'application/zip'} accept={filetype == 'PDF' ? 'application/pdf' : 'application/zip'}
on:filedrop={(e) => onFileDrop(e.detail.files)} on:filedrop={(e) => onFileDrop(e.detail.files)}
on:filedragenter={dashAnimationStart} on:filedragenter={dashAnimationStart}

View file

@ -17,6 +17,6 @@
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={e => onFileDrop(e.detail)}
title="Portfolio" title="Portfolio"
filetype="PDF" filetype="PDF"
filesize="10 MB" filesize={10}
fileType={2}> fileType={2}>
</DashboardUploadCard> </DashboardUploadCard>

View file

@ -17,6 +17,6 @@
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={e => onFileDrop(e.detail)}
title="Další data" title="Další data"
filetype="ZIP" filetype="ZIP"
filesize="100 MB" filesize={100}
fileType={3}> fileType={3}>
</DashboardUploadCard> </DashboardUploadCard>