From 1ae27f0d6675430b55f2cce44f7c65cff34c27c8 Mon Sep 17 00:00:00 2001 From: catarak Date: Thu, 25 Aug 2016 17:32:27 -0400 Subject: [PATCH] add file icons and file types default to file --- client/images/folder-triangle.svg | 14 +++++++++++++ client/images/folder.svg | 12 +++++++++++ client/modules/IDE/actions/files.js | 4 ++-- client/modules/IDE/components/FileNode.js | 11 ++++++++++ client/modules/IDE/components/Sidebar.js | 11 ++++++++-- client/modules/IDE/reducers/files.js | 14 ++++++++----- client/styles/components/_sidebar.scss | 25 +++++++++++++++++++---- server/models/project.js | 2 +- 8 files changed, 79 insertions(+), 14 deletions(-) create mode 100644 client/images/folder-triangle.svg create mode 100644 client/images/folder.svg diff --git a/client/images/folder-triangle.svg b/client/images/folder-triangle.svg new file mode 100644 index 00000000..1843a73e --- /dev/null +++ b/client/images/folder-triangle.svg @@ -0,0 +1,14 @@ + + + + Triangle 3 + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/client/images/folder.svg b/client/images/folder.svg new file mode 100644 index 00000000..172b4d75 --- /dev/null +++ b/client/images/folder.svg @@ -0,0 +1,12 @@ + + + + "." project folder + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/client/modules/IDE/actions/files.js b/client/modules/IDE/actions/files.js index 638aca56..aeba6588 100644 --- a/client/modules/IDE/actions/files.js +++ b/client/modules/IDE/actions/files.js @@ -74,7 +74,7 @@ export function createFile(formProps) { const postParams = { name: createUniqueName(formProps.name, state.files), url: formProps.url, - content: formProps.content || '' + content: formProps.content || '', // TODO pass parent id to API, once there are folders parentId: rootFile.id }; @@ -107,7 +107,7 @@ export function createFile(formProps) { id, _id: id, url: formProps.url, - content: formProps.content || '' + content: formProps.content || '', // TODO pass parent id from File Tree parentId: rootFile.id }); diff --git a/client/modules/IDE/components/FileNode.js b/client/modules/IDE/components/FileNode.js index 6048aefa..ebd3abf1 100644 --- a/client/modules/IDE/components/FileNode.js +++ b/client/modules/IDE/components/FileNode.js @@ -5,6 +5,7 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import InlineSVG from 'react-inlinesvg'; const downArrowUrl = require('../../../images/down-arrow.svg'); +const fileUrl = require('../../../images/file.svg'); import classNames from 'classnames'; export class FileNode extends React.Component { @@ -70,6 +71,15 @@ export class FileNode extends React.Component { if (this.props.name !== 'root') { return (
+ {(() => { // eslint-disable-line + if (this.props.type === 'file') { + return ( + + + + ); + } + })()} {this.props.name}
-

Sketch Files

+

+ + + + project-folder +