add resizers

This commit is contained in:
catarak 2016-08-11 15:41:13 -04:00
parent 5877b82933
commit 93d6d8777f
6 changed files with 122 additions and 55 deletions

View file

@ -14,6 +14,7 @@ import * as IDEActions from '../actions/ide';
import * as ProjectActions from '../actions/project'; import * as ProjectActions from '../actions/project';
import * as PreferencesActions from '../actions/preferences'; import * as PreferencesActions from '../actions/preferences';
import { getFile, getHTMLFile, getJSFiles, getCSSFiles, setSelectedFile } from '../reducers/files'; import { getFile, getHTMLFile, getJSFiles, getCSSFiles, setSelectedFile } from '../reducers/files';
import SplitPane from 'react-split-pane';
class IDEView extends React.Component { class IDEView extends React.Component {
componentDidMount() { componentDidMount() {
@ -87,49 +88,62 @@ class IDEView extends React.Component {
setAutosave={this.props.setAutosave} setAutosave={this.props.setAutosave}
/> />
<div className="editor-preview-container"> <div className="editor-preview-container">
<Sidebar <SplitPane split="vertical" defaultSize={180}>
files={this.props.files} <Sidebar
setSelectedFile={this.props.setSelectedFile}
newFile={this.props.newFile}
isExpanded={this.props.ide.sidebarIsExpanded}
expandSidebar={this.props.expandSidebar}
collapseSidebar={this.props.collapseSidebar}
showFileOptions={this.props.showFileOptions}
hideFileOptions={this.props.hideFileOptions}
deleteFile={this.props.deleteFile}
showEditFileName={this.props.showEditFileName}
hideEditFileName={this.props.hideEditFileName}
updateFileName={this.props.updateFileName}
/>
<div className="editor-console-container">
<Editor
file={this.props.selectedFile}
updateFileContent={this.props.updateFileContent}
fontSize={this.props.preferences.fontSize}
indentationAmount={this.props.preferences.indentationAmount}
isTabIndent={this.props.preferences.isTabIndent}
files={this.props.files} files={this.props.files}
setSelectedFile={this.props.setSelectedFile}
newFile={this.props.newFile}
isExpanded={this.props.ide.sidebarIsExpanded}
expandSidebar={this.props.expandSidebar}
collapseSidebar={this.props.collapseSidebar}
showFileOptions={this.props.showFileOptions}
hideFileOptions={this.props.hideFileOptions}
deleteFile={this.props.deleteFile}
showEditFileName={this.props.showEditFileName}
hideEditFileName={this.props.hideEditFileName}
updateFileName={this.props.updateFileName}
/> />
<Console <SplitPane
consoleEvent={this.props.ide.consoleEvent} split="vertical"
isPlaying={this.props.ide.isPlaying} defaultSize={'50%'}
isExpanded={this.props.ide.consoleIsExpanded} onChange={() => (this.refs.overlay.style.display = 'block')}
expandConsole={this.props.expandConsole} onDragFinished={() => (this.refs.overlay.style.display = 'none')}
collapseConsole={this.props.collapseConsole} >
/> <SplitPane split="horizontal" primary="second" defaultSize={29} minSize={29} ref="consolePane">
</div> <Editor
<PreviewFrame file={this.props.selectedFile}
htmlFile={this.props.htmlFile} updateFileContent={this.props.updateFileContent}
jsFiles={this.props.jsFiles} fontSize={this.props.preferences.fontSize}
cssFiles={this.props.cssFiles} indentationAmount={this.props.preferences.indentationAmount}
files={this.props.files} isTabIndent={this.props.preferences.isTabIndent}
content={this.props.selectedFile.content} files={this.props.files}
head={ />
<link type="text/css" rel="stylesheet" href="/preview-styles.css" /> <Console
} consoleEvent={this.props.ide.consoleEvent}
isPlaying={this.props.ide.isPlaying} isPlaying={this.props.ide.isPlaying}
dispatchConsoleEvent={this.props.dispatchConsoleEvent} isExpanded={this.props.ide.consoleIsExpanded}
/> expandConsole={this.props.expandConsole}
collapseConsole={this.props.collapseConsole}
/>
</SplitPane>
<div>
<div className="preview-frame-overlay" ref="overlay">
</div>
<PreviewFrame
htmlFile={this.props.htmlFile}
jsFiles={this.props.jsFiles}
cssFiles={this.props.cssFiles}
files={this.props.files}
content={this.props.selectedFile.content}
head={
<link type="text/css" rel="stylesheet" href="/preview-styles.css" />
}
isPlaying={this.props.ide.isPlaying}
dispatchConsoleEvent={this.props.dispatchConsoleEvent}
/>
</div>
</SplitPane>
</SplitPane>
</div> </div>
{(() => { {(() => {
if (this.props.ide.modalIsVisible) { if (this.props.ide.modalIsVisible) {

View file

@ -1,10 +1,6 @@
.preview-console { .preview-console {
position: absolute;
width: 100%; width: 100%;
height: #{150 / $base-font-size}rem; height: 100%;
right: 0;
bottom: 0;
left: 0;
background: $console-light-background-color; background: $console-light-background-color;
z-index: 1000; z-index: 1000;
overflow: hidden; overflow: hidden;
@ -28,7 +24,7 @@
} }
&.preview-console--collapsed { &.preview-console--collapsed {
height: #{29 / $base-font-size}rem; // height: #{29 / $base-font-size}rem;
} }
} }

View file

@ -0,0 +1,43 @@
.Resizer {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: $ide-border-color;
opacity: .2;
z-index: 1;
-moz-background-clip: padding;
-webkit-background-clip: padding;
background-clip: padding-box;
}
// .Resizer:hover {
// -webkit-transition: all 2s ease;
// transition: all 2s ease;
// }
.Resizer.horizontal {
height: 11px;
margin: -5px 0;
border-top: 5px solid rgba(255, 255, 255, 0);
border-bottom: 5px solid rgba(255, 255, 255, 0);
cursor: row-resize;
width: 100%;
}
.Resizer.horizontal:hover {
// border-top: 5px solid rgba(0, 0, 0, 0.5);
// border-bottom: 5px solid rgba(0, 0, 0, 0.5);
}
.Resizer.vertical {
width: 11px;
margin: 0 -5px;
border-left: 5px solid rgba(255, 255, 255, 0);
border-right: 5px solid rgba(255, 255, 255, 0);
cursor: col-resize;
}
.Resizer.vertical:hover {
// border-left: 5px solid rgba(0, 0, 0, 0.5);
// border-right: 5px solid rgba(0, 0, 0, 0.5);
}

View file

@ -9,11 +9,13 @@
width: 100%; width: 100%;
flex: 1 0 0px; flex: 1 0 0px;
display: flex; display: flex;
position: relative;
} }
.editor-console-container { .editor-console-container {
flex: 1 0 0px; // flex: 1 0 0px;
max-width: 45%; // max-width: 45%;
width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
@ -28,8 +30,16 @@
} }
.preview-frame { .preview-frame {
flex: 1 0 0px; height: 100%;
min-height: 100%; width: 100%;
position: absolute;
}
.preview-frame-overlay {
height: 100%;
width: 100%;
position: absolute;
z-index: 10;
} }
.toolbar { .toolbar {
@ -37,8 +47,10 @@
} }
.sidebar { .sidebar {
width: #{180 / $base-font-size}rem; // width: #{180 / $base-font-size}rem;
&.sidebar--contracted { // &.sidebar--contracted {
width: #{20 / $base-font-size}rem; // width: #{20 / $base-font-size}rem;
} // }
width: 100%;
height: 100%;
} }

View file

@ -19,6 +19,7 @@
@import 'components/sidebar'; @import 'components/sidebar';
@import 'components/modal'; @import 'components/modal';
@import 'components/console'; @import 'components/console';
@import 'components/resizer';
@import 'layout/ide'; @import 'layout/ide';
@import 'layout/sketch-list'; @import 'layout/sketch-list';

View file

@ -93,6 +93,7 @@
"react-inlinesvg": "^0.4.2", "react-inlinesvg": "^0.4.2",
"react-redux": "^4.4.5", "react-redux": "^4.4.5",
"react-router": "^2.4.1", "react-router": "^2.4.1",
"react-split-pane": "^0.1.44",
"redux": "^3.5.2", "redux": "^3.5.2",
"redux-form": "^5.2.5", "redux-form": "^5.2.5",
"redux-thunk": "^2.1.0", "redux-thunk": "^2.1.0",