mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-17 20:31:29 +00:00
Page container is now doign partial rendering, need to clean up the stlying though
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
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{
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ html,body, #reactContainer{
|
|||||||
.paneSplit{
|
.paneSplit{
|
||||||
width : 100%;
|
width : 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
padding-top: 25px;
|
//padding-top: 25px;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.leftPane, .rightPane{
|
.leftPane, .rightPane{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -26,6 +27,7 @@ html,body, #reactContainer{
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
//margin-top: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftPane{
|
.leftPane{
|
||||||
@@ -34,8 +36,9 @@ html,body, #reactContainer{
|
|||||||
.rightPane{
|
.rightPane{
|
||||||
width : 60%;
|
width : 60%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
//overflow-y: scroll;
|
||||||
|
|
||||||
overflow-y: scroll;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,52 @@ var cx = require('classnames');
|
|||||||
|
|
||||||
var Markdown = require('marked');
|
var Markdown = require('marked');
|
||||||
|
|
||||||
|
var PAGE_HEIGHT = 1056 + 30;
|
||||||
|
|
||||||
var PageContainer = React.createClass({
|
var PageContainer = React.createClass({
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
text : ""
|
text : ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
getInitialState: function() {
|
||||||
|
return {
|
||||||
|
scrollPosition: 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
handleScroll : function(e){
|
||||||
|
this.setState({
|
||||||
|
scrollPosition : e.target.scrollTop
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getViewablePageIndex : function(){
|
||||||
|
return Math.floor(this.state.scrollPosition / PAGE_HEIGHT);
|
||||||
|
},
|
||||||
|
|
||||||
|
renderDummyPage : function(key){
|
||||||
|
return <div className='phb' key={key}>
|
||||||
|
yo dawg
|
||||||
|
</div>
|
||||||
|
},
|
||||||
|
|
||||||
renderPages : function(){
|
renderPages : function(){
|
||||||
|
var currentIndex = this.getViewablePageIndex();
|
||||||
return _.map(this.props.text.split('\\page'), (pageText, index) => {
|
return _.map(this.props.text.split('\\page'), (pageText, index) => {
|
||||||
return <div className='phb' dangerouslySetInnerHTML={{__html:Markdown(pageText)}} key={index} />
|
if(currentIndex - 1 == index || currentIndex == index || currentIndex + 1 == index){
|
||||||
|
return <div className='phb' dangerouslySetInnerHTML={{__html:Markdown(pageText)}} key={index} />
|
||||||
|
}else{
|
||||||
|
return this.renderDummyPage(index);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
var self = this;
|
return <div className="pageContainer" onScroll={this.handleScroll}>
|
||||||
return <div className="pageContainer">
|
<div className='pages'>
|
||||||
{this.renderPages()}
|
{this.renderPages()}
|
||||||
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
@import (less) './client/homebrew/phbStyle/phb.style.less';
|
@import (less) './client/homebrew/phbStyle/phb.style.less';
|
||||||
|
|
||||||
.pageContainer{
|
.pageContainer{
|
||||||
padding : 30px 0px;
|
|
||||||
background-color : @steel;
|
background-color : @steel;
|
||||||
&>.phb{
|
margin-top: 25px;
|
||||||
margin-right : auto;
|
overflow-y: scroll;
|
||||||
margin-bottom : 30px;
|
height : 100%;
|
||||||
margin-left : auto;
|
.pages{
|
||||||
box-shadow : 1px 4px 14px #000;
|
padding : 30px 0px;
|
||||||
|
|
||||||
|
&>.phb{
|
||||||
|
margin-right : auto;
|
||||||
|
margin-bottom : 30px;
|
||||||
|
margin-left : auto;
|
||||||
|
box-shadow : 1px 4px 14px #000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "naturalCrit",
|
"name": "naturalCrit",
|
||||||
"description": "A super rad project!",
|
"description": "A super rad project!",
|
||||||
"version": "1.3.1",
|
"version": "1.4.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "gulp prod",
|
"postinstall": "gulp prod",
|
||||||
"start": "node server.js"
|
"start": "node server.js"
|
||||||
|
|||||||
Reference in New Issue
Block a user