Skip to content

Commit bec0a82

Browse files
committed
change to material
1 parent 4665dad commit bec0a82

File tree

2 files changed

+34
-46
lines changed

2 files changed

+34
-46
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons/GetIconURL.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,16 @@ const icons = {
5252
reason: reasonSvg,
5353
};
5454

55-
const directoryMapping = {
56-
'directory-open': 'default_folder_opened',
57-
directory: 'default_folder',
58-
};
59-
6055
async function getIconURL(type) {
6156
const base =
62-
'https://cdn.rawgit.com/vscode-icons/vscode-icons/806a23ec/icons';
57+
'https://cdn.rawgit.com/PKief/vscode-material-icon-theme/e04ab459/icons/';
6358

6459
let url;
6560

66-
if (type === 'directory-open' || type === 'directory') {
67-
url = `${base}/${directoryMapping[type]}.svg`;
68-
} else if (type === 'codesandbox') {
61+
if (type === 'codesandbox') {
6962
url = codesandboxSvg;
7063
} else {
71-
url = `${base}/file_type_${type}.svg`;
64+
url = `${base}/${type}.svg`;
7265
}
7366

7467
try {

packages/app/src/app/utils/get-type.js

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,46 @@ const mdRegex = /\.md$/;
55
const yamlRegex = /\.yml$/;
66
const svgRegex = /\.svg$/;
77
const jsxRegex = /\.jsx$/;
8+
const tsRegex = /\.tsx?$/;
9+
const jsRegex = /\.js$/;
10+
const reasonRegex = /\.re$/;
11+
const sassRegex = /\.scss$/;
812

913
export function getMode(title: string = '') {
10-
const removeIgnoreTitle = title.split('ignore')[0];
11-
12-
if (removeIgnoreTitle === 'favicon.ico') {
13-
return 'favicon';
14-
}
15-
16-
if (removeIgnoreTitle === 'yarn.lock') {
17-
return 'yarn';
18-
}
19-
20-
if (removeIgnoreTitle === '.travis.yml') {
21-
return 'travis';
22-
}
14+
const removeIgnoreTitle = title.split('ignore')[0].toLowerCase();
2315

24-
if (removeIgnoreTitle === 'package.json') {
25-
return 'npm';
26-
}
16+
// EXCEPTIONS
2717

28-
if (removeIgnoreTitle === 'sandbox.config.json') {
29-
return 'codesandbox';
30-
}
18+
if (removeIgnoreTitle === 'favicon.ico') return 'favicon';
19+
if (removeIgnoreTitle === 'yarn.lock') return 'yarn';
20+
if (removeIgnoreTitle === '.travis.yml') return 'travis';
21+
if (removeIgnoreTitle === 'package.json') return 'npm';
22+
if (removeIgnoreTitle === 'sandbox.config.json') return 'codesandbox';
23+
if (removeIgnoreTitle === 'readme.md') return 'readme';
24+
if (removeIgnoreTitle === 'contributing.md') return 'contributing';
3125

26+
// TEST BASED
3227
if (mdRegex.test(removeIgnoreTitle)) return 'markdown';
3328
if (yamlRegex.test(removeIgnoreTitle)) return 'yaml';
34-
if (jsxRegex.test(removeIgnoreTitle)) return 'reactjs';
29+
if (jsxRegex.test(removeIgnoreTitle)) return 'react';
30+
if (reasonRegex.test(removeIgnoreTitle)) return 'reason';
31+
if (sassRegex.test(removeIgnoreTitle)) return 'sass';
3532
if (!removeIgnoreTitle.includes('.')) return 'raw';
33+
if (removeIgnoreTitle.startsWith('.flow')) return 'flow';
34+
if (
35+
removeIgnoreTitle.endsWith('.module.ts') ||
36+
removeIgnoreTitle.endsWith('.component.ts')
37+
)
38+
return 'angular';
3639
if (removeIgnoreTitle.includes('webpack')) return 'webpack';
40+
if (jsRegex.test(removeIgnoreTitle)) return 'javascript';
41+
if (
42+
tsRegex.test(title) ||
43+
title === 'tsconfig.json' ||
44+
title === 'tslint.json'
45+
) {
46+
return 'typescript';
47+
}
3748

3849
if (isImage(removeIgnoreTitle) && !svgRegex.test(removeIgnoreTitle)) {
3950
return 'image';
@@ -48,22 +59,6 @@ export function getMode(title: string = '') {
4859
return titleArr[titleArr.length - 1];
4960
}
5061

51-
const tsRegex = /\.tsx?$/;
52-
function isTS(title: string) {
53-
if (
54-
tsRegex.test(title) ||
55-
title === 'tsconfig.json' ||
56-
title === 'tslint.json'
57-
)
58-
return 'typescript';
59-
return undefined;
60-
}
61-
6262
export default function getType(title: string) {
63-
const isTSType = isTS(title);
64-
if (isTSType) {
65-
return isTSType;
66-
}
67-
6863
return getMode(title);
6964
}

0 commit comments

Comments
 (0)