0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-07 01:12:44 +00:00

Split pane scrolling is FINALLY working

This commit is contained in:
Scott Tolksdorf
2016-05-04 02:13:11 -04:00
parent 75fb606097
commit 1ce0f00b62
8 changed files with 65 additions and 86 deletions

View File

@@ -4,9 +4,8 @@
height : 100%; height : 100%;
min-height : 100%; min-height : 100%;
width : 100%; width : 100%;
margin-top: 25px; //display: flex;
display: flex; //flex-direction: column;
flex-direction: column;
.textIcons{ .textIcons{
display : inline-block; display : inline-block;
vertical-align : top; vertical-align : top;

View File

@@ -59,7 +59,6 @@ var HomePage = React.createClass({
render : function(){ render : function(){
return( return(
<div className='homePage page'> <div className='homePage page'>
<Navbar> <Navbar>
<Nav.item <Nav.item
href='/homebrew/changelog' href='/homebrew/changelog'
@@ -76,25 +75,12 @@ var HomePage = React.createClass({
</Navbar> </Navbar>
<div className='content'> <div className='content'>
<SplitPane> <SplitPane>
<div className='woo'> <Editor text={this.state.text} onChange={this.handleTextChange} />
one <PageContainer text={this.state.text} />
</div>
<div className='cool'>
two
</div>
</SplitPane> </SplitPane>
</div> </div>
<a href='/homebrew/new' className='floatingNewButton'> <a href='/homebrew/new' className='floatingNewButton'>
Create your own <i className='fa fa-magic' /> Create your own <i className='fa fa-magic' />
</a> </a>
@@ -106,26 +92,16 @@ var HomePage = React.createClass({
module.exports = HomePage; module.exports = HomePage;
/* /* Test code
<div className='temp'> <div className='content'>
test <SplitPane>
<div className='woo'>
<div className='woo' /> one
</div>
</div> <div className='temp'>
*/ yo
<div className='tooBig' />
</div>
/* </SplitPane>
<div className='paneSplit'>
<div className='leftPane'>
<Editor text={this.state.text} onChange={this.handleTextChange} />
</div>
<div className='rightPane'>
<PageContainer text={this.state.text} />
</div>
</div> </div>
*/ */

View File

@@ -23,44 +23,41 @@ html,body, #reactContainer{
flex-direction: column; flex-direction: column;
nav{
//height : 22px;
}
.content{ .content{
background-color: red;
flex: auto; flex: auto;
//position: relative; position: relative;
height: calc(~"100% - 29px");
//overflow-y: scroll;
.pane{
}
.woo{ .woo{
background-color: @red; background-color: @red;
} }
.cool{
background-color: @green;
height : 500px;
}
.temp{ .temp{
flex: auto; background-color: @green;
overflow-y: scroll; //max-height : 100%;
//height : 100%;
//overflow: scroll;
.woo{ .tooBig{
width: 50px; background-color: @purple;
height : 2000px; width : 50px;
background-color: green; height : 5000px;
} }
} }
} }
} }
/*
.paneSplit{ .paneSplit{
width : 100%; width : 100%;
height: 100vh; height: 100vh;
@@ -90,4 +87,5 @@ html,body, #reactContainer{
} }
} }
*/
} }

View File

@@ -2,9 +2,9 @@
.pageContainer{ .pageContainer{
background-color : @steel; background-color : @steel;
overflow-y: scroll; // overflow-y: scroll;
height :100%; //height :100%;
.pages{ .pages{

View File

@@ -3,15 +3,13 @@ var _ = require('lodash');
var cx = require('classnames'); var cx = require('classnames');
var SplitPane = React.createClass({ var SplitPane = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
storageKey : 'naturalcrit-pane-split-test', storageKey : 'naturalcrit-pane-split',
size : null, size : null,
isDragging : false isDragging : false
}; };
}, },
componentDidMount: function() { componentDidMount: function() {
var paneSize = window.localStorage.getItem(this.props.storageKey); var paneSize = window.localStorage.getItem(this.props.storageKey);
if(paneSize){ if(paneSize){
@@ -22,10 +20,11 @@ var SplitPane = React.createClass({
}, },
handleUp : function(){ handleUp : function(){
this.setState({ isDragging : false }) this.setState({ isDragging : false });
}, },
handleDown : function(){ handleDown : function(){
this.setState({ isDragging : true }) this.setState({ isDragging : true });
this.unFocus()
}, },
handleMove : function(e){ handleMove : function(e){
if(!this.state.isDragging) return; if(!this.state.isDragging) return;
@@ -35,6 +34,14 @@ var SplitPane = React.createClass({
window.localStorage.setItem(this.props.storageKey, e.pageX); window.localStorage.setItem(this.props.storageKey, e.pageX);
}, },
unFocus : function() {
if(document.selection){
document.selection.empty();
}else{
window.getSelection().removeAllRanges();
}
},
renderDivider : function(){ renderDivider : function(){
return <div return <div
className='divider' className='divider'
@@ -44,9 +51,9 @@ var SplitPane = React.createClass({
render : function(){ render : function(){
return <div className='splitPane' onMouseMove={this.handleMove} onMouseUp={this.handleUp}> return <div className='splitPane' onMouseMove={this.handleMove} onMouseUp={this.handleUp}>
<Pane width={this.state.size}>{this.props.children[0]}</Pane> <Pane ref='pane1' width={this.state.size}>{this.props.children[0]}</Pane>
{this.renderDivider()} {this.renderDivider()}
<Pane>{this.props.children[1]}</Pane> <Pane ref='pane2'>{this.props.children[1]}</Pane>
</div> </div>
} }
}); });
@@ -65,7 +72,6 @@ var Pane = React.createClass({
width : this.props.width + 'px' width : this.props.width + 'px'
} }
} }
return <div className={cx('pane', this.props.className)} style={styles}> return <div className={cx('pane', this.props.className)} style={styles}>
{this.props.children} {this.props.children}
</div> </div>

View File

@@ -7,6 +7,7 @@
flex-direction : row; flex-direction : row;
.pane{ .pane{
flex : 1; flex : 1;
overflow-x: hidden;
} }
.divider{ .divider{
width : 5px; width : 5px;

View File

@@ -9,11 +9,9 @@
} }
nav{ nav{
background-color : #333; background-color : #333;
.navContent{ .navContent{
display : flex; display : flex;
justify-content : space-between;
justify-content : space-between;
} }
.navSection{ .navSection{
display : flex; display : flex;
@@ -26,13 +24,10 @@ nav{
margin-left : 8px; margin-left : 8px;
color : white; color : white;
text-decoration : none; text-decoration : none;
&:hover{ &:hover{
.name{ color : @orange; } .name{ color : @orange; }
svg{ fill : @orange } svg{ fill : @orange }
} }
svg{ svg{
height : 13px; height : 13px;
margin-right : 0.2em; margin-right : 0.2em;
@@ -58,11 +53,14 @@ nav{
padding : 8px 12px; padding : 8px 12px;
cursor : pointer; cursor : pointer;
background-color : #333; background-color : #333;
font-size : 12px; font-size : 10px;
font-weight : 800;
color : white; color : white;
text-decoration: none; text-decoration : none;
text-transform : uppercase;
i{ i{
margin-left : 5px; margin-left : 5px;
font-size : 13px;
} }
&.tealLight:hover{ background-color : @tealLight }; &.tealLight:hover{ background-color : @tealLight };
&.teal:hover{ background-color : @teal }; &.teal:hover{ background-color : @teal };
@@ -85,7 +83,6 @@ nav{
&.greyLight:hover{ background-color : @greyLight }; &.greyLight:hover{ background-color : @greyLight };
&.grey:hover{ background-color : @grey }; &.grey:hover{ background-color : @grey };
} }
.navSection + .navSection .navItem{ .navSection + .navSection .navItem{
border-left : 1px solid #666; border-left : 1px solid #666;
} }

14
todo.md
View File

@@ -1,14 +1,16 @@
# The Homebrewery # The Homebrewery
## v1.5 todo ## v1.5 todo
- Make statusbar un-fixed X Make statusbar un-fixed
- Simplify the panel css to remove the current issues X Simplify the panel css to remove the current issues
- Build new `BrewRenderer`, clean support for partial rendering
- Add `infoBox` to BrewRenderer to show views, and current pages
- Add in markdown editor
- Add bleed snippet (bump) - Add bleed snippet (bump)
- Add the '/new' page and force save to reduce database size - Add the '/new' page and force save to reduce database size
! Add pagniation and query to the homebrew api X Add pagniation and query to the homebrew api
! Update the admin page with pagnition and a query box X Update the admin page with pagnition and a query box
! Test the old/small brew filtering for deleteion X Test the old/small brew filtering for deleteion
- Make the status bar take children? Or just give it a string of booleans. Just simplify it
- Partial rendering kills style tags on unrendered pages. Detect if pages have style tags and render them. - Partial rendering kills style tags on unrendered pages. Detect if pages have style tags and render them.
- Add in the link of Pateron? - Add in the link of Pateron?