diff --git a/src/routes/dashboard/[workspace_id].tsx b/src/routes/dashboard/[workspace_id].tsx index e45cdda..b13bfbf 100644 --- a/src/routes/dashboard/[workspace_id].tsx +++ b/src/routes/dashboard/[workspace_id].tsx @@ -22,8 +22,6 @@ import IconAccountMultipleOutline from "~icons/mdi/account-multiple-outline"; import IconTrashCanOutline from "~icons/mdi/trash-can-outline"; import IconAccount from "~icons/mdi/account"; import IconMenuDown from "~icons/mdi/menu-down"; -import IconFileOutline from "~icons/mdi/file-outline"; -import IconFileImageOutline from "~icons/mdi/file-image-outline"; import IconDownload from "~icons/mdi/download"; import IconDeleteOutline from "~icons/mdi/delete-outline"; import IconDotsHorizontal from "~icons/mdi/dots-horizontal"; @@ -32,6 +30,7 @@ import IconClose from "~icons/mdi/close"; import cattoDriveLogo from "@/assets/icon/logo.png"; import FullscreenLoader from "@/components/FullscreenLoader"; +import { getFileIcon } from "@/utils/getFileIcons"; import { DropdownMenu, Dialog } from "@kobalte/core"; @@ -89,17 +88,6 @@ const Page: Component = () => { } }; - const getFileIcon = (file: any) => { - const fileExtension = file.name.split(".").pop().toLowerCase(); - const imageFileExtensions = ["png", "jpg", "jpeg", "gif", "webp"]; - - if (imageFileExtensions.indexOf(fileExtension) !== -1) { - return ; - } else { - return ; - } - }; - createEffect(() => { window.scrollTo(0, 0); }); diff --git a/src/utils/getFileIcons.tsx b/src/utils/getFileIcons.tsx new file mode 100644 index 0000000..c81ceaf --- /dev/null +++ b/src/utils/getFileIcons.tsx @@ -0,0 +1,13 @@ +import IconFileOutline from "~icons/mdi/file-outline"; +import IconFileImageOutline from "~icons/mdi/file-image-outline"; + +export const getFileIcon = (file: any) => { + const fileExtension = file.name.split(".").pop().toLowerCase(); + const imageFileExtensions = ["png", "jpg", "jpeg", "gif", "webp"]; + + if (imageFileExtensions.indexOf(fileExtension) !== -1) { + return ; + } else { + return ; + } +};