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

Commit dc30d21

Browse files
darkwingjasonLaster
authored andcommitted
Reformat the getIcon code (#5723)
1 parent 3e20a35 commit dc30d21

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/components/PrimaryPanes/SourcesTree.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ type State = {
7272
highlightItems?: any
7373
};
7474

75+
const sourceTypes = {
76+
coffee: "coffeescript",
77+
js: "javascript",
78+
jsx: "react",
79+
ts: "typescript"
80+
};
81+
7582
class SourcesTree extends Component<Props, State> {
7683
focusItem: Function;
7784
selectItem: Function;
@@ -210,17 +217,9 @@ class SourcesTree extends Component<Props, State> {
210217
if (source && source.get("isBlackBoxed")) {
211218
return <img className="blackBox" />;
212219
}
213-
const sourceType = {
214-
coffee: "coffeescript",
215-
js: "javascript",
216-
jsx: "react",
217-
ts: "typescript"
218-
}[getExtension(source)];
219-
return sourceType ? (
220-
<img className={sourceType} />
221-
) : (
222-
<img className="file" />
223-
);
220+
221+
const sourceType = sourceTypes[getExtension(source)];
222+
return <img className={sourceType || "file"} />;
224223
}
225224

226225
return <img className="folder" />;

0 commit comments

Comments
 (0)