import { useCallback } from "react"; import Icon from "@components/icons"; import Close from "@components/icons/close"; const SimpleFile: React.FC<{ file: any; onPathChange: (key: string) => void; currentPath?: string; onCloseFile: (key: string) => void; }> = ({ file, onPathChange, currentPath = "", onCloseFile }) => { // console.log("file", file); const handlePathChange = useCallback( (e: any) => { const key = e.currentTarget.dataset.src!; onPathChange(key); }, [onPathChange] ); let fileType; if (file.name && file.name.indexOf(".") !== -1) { fileType = `file_type_${file.name.split(".").slice(-1)}`; } else { fileType = "default_file"; } return (
{ e.stopPropagation(); onCloseFile(file.path); }} className="music-monaco-editor-list-close-icon" /> {file.name} {file.path}
); }; export default SimpleFile;