From 2d11985c18108615abbba2d6dae52ae41d02399f Mon Sep 17 00:00:00 2001 From: journey-ad Date: Sun, 23 Jun 2024 01:49:33 +0800 Subject: [PATCH] :sparkles: Add subtitles icon --- components/FileTypeIcon.tsx | 42 +---- components/icons.tsx | 291 ------------------------------- styles/file-type-icon/icons.css | 7 +- styles/file-type-icon/scroll.svg | 1 + 4 files changed, 10 insertions(+), 331 deletions(-) create mode 100644 styles/file-type-icon/scroll.svg diff --git a/components/FileTypeIcon.tsx b/components/FileTypeIcon.tsx index bb3ea6c..992a4fb 100644 --- a/components/FileTypeIcon.tsx +++ b/components/FileTypeIcon.tsx @@ -1,41 +1,16 @@ "use client"; -import { - FileTypeAudioIcon, - FileTypeBookIcon, - FileTypeFileIcon, - FileTypeFolderIcon, - FileTypeImageIcon, - FileTypeVideoIcon, - FileTypeWebIcon, - FileTypeArchiveIcon, - FileTypeDiskIcon, - FileTypeExecutableIcon, -} from "@/components/icons"; - -const fileTypeIcons = { - folder: , // 📁 - file: , // 📄, - image: , // 🖼️, - video: , // 🎞️, - audio: , // 🎵, - book: , // 📚, - web: , // 🌐, - archive: , // 📦️, - disk: , // 💿, - executable: , // ⚙️, -}; - const extensionMap = { folder: "folder", audio: "mp3,wav,ogg,m4a,flac,wma,aac,mid,midi,cue", image: "jpg,jpeg,png,gif,bmp,svg,webp,tiff,ico,heic,raw,psd,ai", - video: "mp4,mkv,webm,avi,mov,flv,wmv,mpeg,mpg,3gp,3g2,m4v,rm,rmvb,ts,m2ts", + video: "mp4,mkv,webm,avi,mov,flv,wmv,mpeg,mpg,3gp,m4v,rm,rmvb,ts,m2ts,pmp", book: "pdf,epub,fb2,mobi,azw,azw3,cbr,cbz,chm", web: "torrent,html,htm,php,url,asp,aspx,jsp", archive: "zip,rar,7z,gz,bz2,tar,xpi,rpm,cab,lzh,dmg,z,lz,xz,tgz,tbz2", disk: "iso,img,vmdk,vdi", executable: "exe,msi,apk,xpi,deb,bat,sh,bin,dll,so,cmd,com,run,vbs,app", + subtitle: "srt,sub,ssa,ass,vtt,rt,rtx,smi", }; const extensionArr = Object.fromEntries( @@ -56,12 +31,6 @@ const getFileType = (extension?: string) => { return "file"; // Default type for unknown file extensions }; -const getFileTypeIcon = (extension?: string) => { - const type = getFileType(extension); - - return fileTypeIcons[type as keyof typeof fileTypeIcons]; -}; - export default function FileTypeIcon({ extension, className, @@ -70,16 +39,11 @@ export default function FileTypeIcon({ className?: string; }) { const type = getFileType(extension); - // const icon = getFileTypeIcon(extension); const defaultClassName = "file-type-icon"; if (!className) className = defaultClassName; else className = `${defaultClassName} ${className}`; - return ( - - {/* {icon} */} - - ); + return ; } diff --git a/components/icons.tsx b/components/icons.tsx index d38b330..4532d6b 100644 --- a/components/icons.tsx +++ b/components/icons.tsx @@ -258,297 +258,6 @@ export const InfoFilledIcon: React.FC = ({ ); -export const FileTypeFolderIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - -); - -export const FileTypeFileIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - - - -); - -export const FileTypeImageIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - - - - - - - - - -); - -export const FileTypeVideoIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - -); - -export const FileTypeAudioIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - -); - -export const FileTypeBookIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - - - - - - - - - - - -); - -export const FileTypeWebIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - -); - -export const FileTypeArchiveIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - - - - - -); - -export const FileTypeDiskIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - -); - -export const FileTypeExecutableIcon: React.FC = ( - props: IconSvgProps, -) => ( - - - - - -); - export const MagnetIcon: React.FC = (props: IconSvgProps) => ( \ No newline at end of file