Skip to content

Commit

Permalink
lint by removing any types (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thykof authored Jan 10, 2024
1 parent cafd5be commit f971454
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/components/DragDrop/DragDrop.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import React from 'react';
import React, { ChangeEvent, DragEvent } from 'react';

import { ComponentPropsWithoutRef, useRef, useState } from 'react';
import { FiArchive, FiCheckCircle, FiAlertCircle } from 'react-icons/fi';
Expand Down Expand Up @@ -60,9 +60,13 @@ export function DragDrop(props: IDragDropProps) {
return true;
}

function handleOnChange(e: any) {
function handleOnChange(e: ChangeEvent<HTMLInputElement>) {
e.preventDefault();

if (!e.target.files) {
return;
}

[...e.target.files].forEach((file) => {
if (!isValidFile(file.name.toLowerCase())) {
return;
Expand All @@ -75,13 +79,20 @@ export function DragDrop(props: IDragDropProps) {
});
}

function handleOnDropHandler(e: any) {
function handleOnDropHandler(e: DragEvent) {
e.preventDefault();

if (!e.dataTransfer) {
return;
}

if (e.dataTransfer.items) {
[...e.dataTransfer.items].forEach((item) => {
if (item.kind === 'file') {
const file = item.getAsFile();
if (!file) {
return;
}

if (!isValidFile(file.name.toLowerCase() || '')) {
return;
Expand All @@ -107,7 +118,7 @@ export function DragDrop(props: IDragDropProps) {
}
}

function handleDragOverHandler(e: any) {
function handleDragOverHandler(e: DragEvent) {
e.preventDefault();
}

Expand Down

0 comments on commit f971454

Please sign in to comment.