Rename function and variable
This commit is contained in:
parent
124ec2d80b
commit
4a9bddd767
2 changed files with 7 additions and 7 deletions
|
@ -3,18 +3,18 @@
|
|||
import Dropzone from "./Dropzone.svelte";
|
||||
import FileList from "./FileList.svelte";
|
||||
|
||||
import { filterFileRequirements } from "../utils/filterFileRequirements";
|
||||
import { filterFiles } from "../utils/filterFiles";
|
||||
|
||||
let acceptedFiles;
|
||||
let rejectedFiles;
|
||||
let isAcceptedFilesRendered = false;
|
||||
let areAcceptedFilesRendered = false;
|
||||
const fileRequirements = {
|
||||
supportedFormats: [".pes"],
|
||||
maxSize: 700000,
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
isAcceptedFilesRendered = true;
|
||||
areAcceptedFilesRendered = true;
|
||||
};
|
||||
|
||||
const onDrop = (evt) => {
|
||||
|
@ -23,13 +23,13 @@
|
|||
|
||||
const onChange = (evt) => {
|
||||
acceptedFiles = null;
|
||||
isAcceptedFilesRendered = false;
|
||||
areAcceptedFilesRendered = false;
|
||||
|
||||
const changedFiles = evt.dataTransfer
|
||||
? evt.dataTransfer.files
|
||||
: evt.target.files;
|
||||
|
||||
const results = filterFileRequirements(changedFiles, fileRequirements);
|
||||
const results = filterFiles(changedFiles, fileRequirements);
|
||||
acceptedFiles = results.accepted;
|
||||
rejectedFiles = results.rejected;
|
||||
};
|
||||
|
@ -69,7 +69,7 @@
|
|||
<input type="submit" value="Render files" />
|
||||
</form>
|
||||
|
||||
{#if isAcceptedFilesRendered}
|
||||
{#if areAcceptedFilesRendered}
|
||||
<CardList files={acceptedFiles} />
|
||||
{:else}
|
||||
<FileList title="Rejected Files" files={rejectedFiles} isError />
|
||||
|
|
|
@ -5,7 +5,7 @@ const areRequirementsFulfilled = (requirements, file) =>
|
|||
requirements.maxSize >= file.size &&
|
||||
requirements.supportedFormats.includes(formattedFilenameExt(file.name));
|
||||
|
||||
export function filterFileRequirements(files, requirements) {
|
||||
export function filterFiles(files, requirements) {
|
||||
let accepted = [];
|
||||
let rejected = [];
|
||||
Array.from(files).forEach((file) => {
|
Loading…
Reference in a new issue