Add icons to file tree

This commit is contained in:
Anthony Laibe 2018-10-25 08:06:37 +01:00
parent 3d5028e41b
commit 8ae6c6c154
147 changed files with 822 additions and 40 deletions

View File

@ -81,7 +81,7 @@
"start": "npm-run-all --parallel css-compile react-start watch-css", "start": "npm-run-all --parallel css-compile react-start watch-css",
"build": "npm run css-compile && node scripts/build.js", "build": "npm run css-compile && node scripts/build.js",
"test": "node scripts/test.js --env=jsdom", "test": "node scripts/test.js --env=jsdom",
"css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 src/dark-theme/coreui.scss src/css/coreui-dark.css", "css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 src/scss/coreui.scss src/css/coreui-dark.css && node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 src/scss/icons.scss src/css/icons.css",
"watch-css": "nodemon --ignore dist/ -e scss -x \"npm run css-compile\"" "watch-css": "nodemon --ignore dist/ -e scss -x \"npm run css-compile\""
}, },
"homepage": "http://localhost:8000/embark", "homepage": "http://localhost:8000/embark",

View File

@ -3,22 +3,23 @@ import {Label} from 'reactstrap';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {Treebeard, decorators} from 'react-treebeard'; import {Treebeard, decorators} from 'react-treebeard';
import classNames from 'classnames';
const style = { const style = {
tree: { tree: {
base: { base: {
height: '100%', height: '450px',
overflowX: 'auto',
listStyle: 'none', listStyle: 'none',
backgroundColor: '#1C1C1C', backgroundColor: '#1C1C1C',
color: '#ffffff',
padding: '10px 0 0 10px',
margin: 0, margin: 0,
padding: 0,
color: '#9DA5AB',
fontFamily: 'lucida grande ,tahoma,verdana,arial,sans-serif',
fontSize: '14px'
}, },
node: { node: {
base: { base: {
position: 'relative' position: 'relative',
verticalAlign: 'middle',
}, },
link: { link: {
cursor: 'pointer', cursor: 'pointer',
@ -26,37 +27,24 @@ const style = {
padding: '0px 5px', padding: '0px 5px',
display: 'block' display: 'block'
}, },
activeLink: {
background: '#31363F'
},
toggle: { toggle: {
base: { base: {
position: 'relative',
display: 'inline-block', display: 'inline-block',
verticalAlign: 'top', marginRight: '10px'
marginLeft: '-5px',
height: '24px',
width: '24px'
}, },
wrapper: { wrapper: {
position: 'absolute', margin: '-7px 0 0 0',
top: '50%',
left: '50%',
margin: '-7px 0 0 -7px',
height: '14px'
}, },
height: 14, height: 7,
width: 14, width: 7,
arrow: { arrow: {
fill: '#9DA5AB', fill: '#FFFFFF',
strokeWidth: 0 strokeWidth: 0
} }
}, },
header: { header: {
base: { base: {
display: 'inline-block', display: 'inline-block',
verticalAlign: 'top',
color: '#9DA5AB'
}, },
connector: { connector: {
width: '2px', width: '2px',
@ -69,12 +57,11 @@ const style = {
}, },
title: { title: {
lineHeight: '24px', lineHeight: '24px',
verticalAlign: 'middle'
} }
}, },
subtree: { subtree: {
listStyle: 'none', listStyle: 'none',
paddingLeft: '19px' paddingLeft: '22px'
}, },
loading: { loading: {
color: '#E2C089' color: '#E2C089'
@ -83,15 +70,62 @@ const style = {
} }
}; };
const Header = ({style, node}) => { const Header = ({style, node}) => {
const iconType = node.children ? 'folder' : 'file'; let icon;
const iconClass = `fe fe-${iconType}`;
const iconStyle = {marginRight: '5px'}; if (!node.children) {
const extension = node.path.split('.').pop();
switch(extension) {
case 'html':
icon = 'text-danger fa fa-html5';
break;
case 'css':
icon = 'text-warning fa fa-css3';
break;
case 'js':
case 'jsx':
icon = 'text-primary icon js-icon';
break;
case 'json':
icon = 'text-success icon hjson-icon';
break;
case 'sol':
icon = 'text-warning icon solidity-icon';
break;
default:
icon = 'fa fa-file-o';
}
} else {
switch(node.name) {
case 'dist':
icon = 'text-danger icon easybuild-icon';
break;
case 'config':
icon = 'text-warning fa fa-cogs';
break;
case 'contracts':
icon = 'text-success icon appstore-icon';
break;
case 'app':
icon = 'text-primary fa fa-code';
break;
case 'test':
icon = 'icon test-dir-icon';
break;
case 'node_modules':
icon = 'fa fa-folder-o';
break;
default:
icon = 'fa fa-folder'
}
}
return ( return (
<div style={style.base}> <div className="mb-1" style={style.base}>
<div style={style.title}> <div style={style.title}>
<i className={iconClass} style={iconStyle} /> <i className={classNames('mr-1', icon)} />
{node.name} {node.name}
</div> </div>
</div> </div>

View File

@ -6,10 +6,7 @@ import FontAwesomeIcon from 'react-fontawesome';
const TextEditorToolbar = (props) => ( const TextEditorToolbar = (props) => (
<ol className="breadcrumb mb-0"> <ol className="breadcrumb mb-0">
<li className="breadcrumb-item"> <li className="breadcrumb-item">
{props.currentFile.name} <Button color="success" size="sm" className="mr-1" onClick={props.save}>
</li>
<li className="breadcrumb-item">
<Button color="success" size="sm" onClick={props.save}>
<FontAwesomeIcon className="mr-2" name="save"/> <FontAwesomeIcon className="mr-2" name="save"/>
Save Save
</Button> </Button>
@ -48,8 +45,7 @@ TextEditorToolbar.propTypes = {
save: PropTypes.func, save: PropTypes.func,
remove: PropTypes.func, remove: PropTypes.func,
toggleShowHiddenFiles: PropTypes.func, toggleShowHiddenFiles: PropTypes.func,
openAsideTab: PropTypes.func, openAsideTab: PropTypes.func
currentFile: PropTypes.object
}; };
export default TextEditorToolbar; export default TextEditorToolbar;

View File

@ -18,8 +18,7 @@ class TextEditorToolbarContainer extends Component {
} }
render() { render() {
return <TextEditorToolbar currentFile={this.props.currentFile} return <TextEditorToolbar isContract={this.props.isContract}
isContract={this.props.isContract}
toggleShowHiddenFiles={this.props.toggleShowHiddenFiles} toggleShowHiddenFiles={this.props.toggleShowHiddenFiles}
openAsideTab={this.props.openAsideTab} openAsideTab={this.props.openAsideTab}
save={() => this.save()} save={() => this.save()}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -15,6 +15,9 @@ import 'simple-line-icons/css/simple-line-icons.css';
import '@coreui/coreui/dist/css/coreui.min.css'; import '@coreui/coreui/dist/css/coreui.min.css';
// Dark theme // Dark theme
import './css/coreui-dark.css'; import './css/coreui-dark.css';
// Custom icons set from https://github.com/file-icons/atom
import './css/icons.css';
// Custom style // Custom style
import './index.css'; import './index.css';

Some files were not shown because too many files have changed in this diff Show More