diff --git a/client/modules/IDE/components/FileNode.jsx b/client/modules/IDE/components/FileNode.jsx index 0b6424a783..2489c5fe13 100644 --- a/client/modules/IDE/components/FileNode.jsx +++ b/client/modules/IDE/components/FileNode.jsx @@ -10,7 +10,7 @@ import * as FileActions from '../actions/files'; import DownArrowIcon from '../../../images/down-filled-triangle.svg'; import FolderRightIcon from '../../../images/triangle-arrow-right.svg'; import FolderDownIcon from '../../../images/triangle-arrow-down.svg'; -import FileIcon from '../../../images/file.svg'; +import FileTypeIcon from './FileTypeIcon'; function parseFileName(name) { const nameArray = name.split('.'); @@ -256,6 +256,7 @@ class FileNode extends React.Component { const isRoot = this.props.name === 'root'; const { t } = this.props; + const { extension } = parseFileName(this.props.name); return (
@@ -267,7 +268,11 @@ class FileNode extends React.Component { {isFile && ( - )} {isFolder && ( diff --git a/client/modules/IDE/components/FileTypeIcon.jsx b/client/modules/IDE/components/FileTypeIcon.jsx new file mode 100644 index 0000000000..c6bab74f4b --- /dev/null +++ b/client/modules/IDE/components/FileTypeIcon.jsx @@ -0,0 +1,59 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { IoLogoHtml5, IoLogoCss3, IoLogoJavascript } from 'react-icons/io'; +import { TbFileTypeXml, TbTxt, TbCsv } from 'react-icons/tb'; +import { VscJson } from 'react-icons/vsc'; +import FileIcon from '../../../images/file.svg'; + +export default function FileTypeIcon({ fileExtension }) { + switch (fileExtension) { + case '.html': + return ( + + + + ); + case '.css': + return ( + + + + ); + case '.js': + return ( + + + + ); + case '.json': + return ( + + + + ); + case '.xml': + return ( + + + + ); + case '.txt': + return ( + + + + ); + case '.csv': + return ( + + + + ); + default: + return