feeles-ide
Version:
The hackable and serializable IDE to make learning material
92 lines (76 loc) • 2.88 kB
JavaScript
import _extends from 'babel-runtime/helpers/extends';
import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { emphasize, fade } from 'material-ui/utils/colorManipulator';
import DirCard from './DirCard';
import getHierarchy from './getHierarchy';
var getStyles = function getStyles(props, context) {
var _context$muiTheme = context.muiTheme,
fontFamily = _context$muiTheme.fontFamily,
palette = _context$muiTheme.palette;
return {
root: {
boxSizing: 'border-box',
width: '100%',
fontFamily: fontFamily,
paddingBottom: 40,
overflowX: 'hidden',
overflowY: 'scroll',
backgroundColor: fade(emphasize(palette.canvasColor, 1), 0.07)
}
};
};
var Root = function (_PureComponent) {
_inherits(Root, _PureComponent);
function Root() {
_classCallCheck(this, Root);
return _possibleConstructorReturn(this, (Root.__proto__ || _Object$getPrototypeOf(Root)).apply(this, arguments));
}
_createClass(Root, [{
key: 'render',
value: function render() {
var files = this.props.files;
var transfer = {
selectedFile: this.props.selectedFile,
tabbedFiles: this.props.tabbedFiles,
isDirOpened: this.props.isDirOpened,
handleFileSelect: this.props.handleFileSelect,
handleDirToggle: this.props.handleDirToggle,
handleFileMove: this.props.handleFileMove,
handleNativeDrop: this.props.handleNativeDrop,
openFileDialog: this.props.openFileDialog,
putFile: this.props.putFile
};
var _getStyles = getStyles(this.props, this.context),
root = _getStyles.root;
var prepareStyles = this.context.muiTheme.prepareStyles;
return React.createElement(
'div',
{ style: prepareStyles(root) },
React.createElement(DirCard, _extends({ dir: getHierarchy(files) }, transfer, { isRoot: true }))
);
}
}]);
return Root;
}(PureComponent);
Root.propTypes = {
files: PropTypes.array.isRequired,
selectedFile: PropTypes.object,
tabbedFiles: PropTypes.array.isRequired,
isDirOpened: PropTypes.func.isRequired,
handleFileSelect: PropTypes.func.isRequired,
handleDirToggle: PropTypes.func.isRequired,
handleFileMove: PropTypes.func.isRequired,
handleNativeDrop: PropTypes.func.isRequired,
openFileDialog: PropTypes.func.isRequired,
putFile: PropTypes.func.isRequired
};
Root.contextTypes = {
muiTheme: PropTypes.object.isRequired
};
export default Root;