Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
🐛 fix and add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jan 27, 2022
1 parent 8a1cda0 commit 4f4a591
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/utils/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ import {
BsFillMarkdownFill,
} from "react-icons/bs";
import { DiAndroid } from "react-icons/di";
import { FaDatabase, FaBook } from "react-icons/fa";
import { FaDatabase, FaBook, FaCompactDisc } from "react-icons/fa";
import { IoIosFolder } from "react-icons/io";

const iconMap = {
"dmg,ipa": BsApple,
exe: BsWindows,
"exe,msi": BsWindows,
"zip,gz,rar,7z,tar,jar,xz": BsFillFileEarmarkZipFill,
apk: DiAndroid,
db: FaDatabase,
md: BsFillMarkdownFill,
epub: FaBook,
iso: FaCompactDisc,
};

const getIcon = (type: number, ext: string) => {
if (type !== 1) {
for (const [extensions, icon] of Object.entries(iconMap)) {
if (extensions.split(",").includes(ext.toLowerCase())) {
return icon;
}
}
}
switch (type) {
case 1:
return IoIosFolder;
Expand All @@ -54,11 +62,6 @@ const getIcon = (type: number, ext: string) => {
case 6:
return BsFillFileEarmarkImageFill;
default:
for (const [extensions, icon] of Object.entries(iconMap)) {
if (extensions.split(",").includes(ext.toLowerCase())) {
return icon;
}
}
return BsFillFileEarmarkMinusFill;
}
};
Expand Down

0 comments on commit 4f4a591

Please sign in to comment.