From c93c6b13c40e1e61f64aa7303dbc552e9de46326 Mon Sep 17 00:00:00 2001 From: Scott Tolksdorf Date: Wed, 6 Apr 2016 00:15:15 -0400 Subject: [PATCH] Page container is now doign partial rendering, need to clean up the stlying though --- client/homebrew/editor/editor.less | 1 + client/homebrew/homebrew.less | 7 +++- .../homebrew/pageContainer/pageContainer.jsx | 37 +++++++++++++++++-- .../homebrew/pageContainer/pageContainer.less | 19 +++++++--- package.json | 2 +- 5 files changed, 53 insertions(+), 13 deletions(-) diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index f77d1c4..2399283 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -4,6 +4,7 @@ height : 100%; min-height : 100%; width : 100%; + margin-top: 25px; display: flex; flex-direction: column; .textIcons{ diff --git a/client/homebrew/homebrew.less b/client/homebrew/homebrew.less index d9a4717..f454f1b 100644 --- a/client/homebrew/homebrew.less +++ b/client/homebrew/homebrew.less @@ -16,9 +16,10 @@ html,body, #reactContainer{ .paneSplit{ width : 100%; height: 100vh; - padding-top: 25px; + //padding-top: 25px; position: relative; box-sizing: border-box; + overflow: hidden; .leftPane, .rightPane{ display: inline-block; @@ -26,6 +27,7 @@ html,body, #reactContainer{ position: relative; height: 100%; min-height: 100%; + //margin-top: 25px; } .leftPane{ @@ -34,8 +36,9 @@ html,body, #reactContainer{ .rightPane{ width : 60%; height: 100%; + //overflow-y: scroll; - overflow-y: scroll; + overflow: hidden; } } diff --git a/client/homebrew/pageContainer/pageContainer.jsx b/client/homebrew/pageContainer/pageContainer.jsx index 5a79390..8ff5df7 100644 --- a/client/homebrew/pageContainer/pageContainer.jsx +++ b/client/homebrew/pageContainer/pageContainer.jsx @@ -4,23 +4,52 @@ var cx = require('classnames'); var Markdown = require('marked'); +var PAGE_HEIGHT = 1056 + 30; + var PageContainer = React.createClass({ getDefaultProps: function() { return { 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
+ yo dawg +
+ }, renderPages : function(){ + var currentIndex = this.getViewablePageIndex(); return _.map(this.props.text.split('\\page'), (pageText, index) => { - return
+ if(currentIndex - 1 == index || currentIndex == index || currentIndex + 1 == index){ + return
+ }else{ + return this.renderDummyPage(index); + } }) }, render : function(){ - var self = this; - return
- {this.renderPages()} + return
+
+ {this.renderPages()} +
; } }); diff --git a/client/homebrew/pageContainer/pageContainer.less b/client/homebrew/pageContainer/pageContainer.less index 1684712..dbf8d29 100644 --- a/client/homebrew/pageContainer/pageContainer.less +++ b/client/homebrew/pageContainer/pageContainer.less @@ -1,12 +1,19 @@ @import (less) './client/homebrew/phbStyle/phb.style.less'; .pageContainer{ - padding : 30px 0px; background-color : @steel; - &>.phb{ - margin-right : auto; - margin-bottom : 30px; - margin-left : auto; - box-shadow : 1px 4px 14px #000; + margin-top: 25px; + overflow-y: scroll; + height : 100%; + .pages{ + padding : 30px 0px; + + &>.phb{ + margin-right : auto; + margin-bottom : 30px; + margin-left : auto; + box-shadow : 1px 4px 14px #000; + } } + } \ No newline at end of file diff --git a/package.json b/package.json index 900bd4c..dc24b07 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "naturalCrit", "description": "A super rad project!", - "version": "1.3.1", + "version": "1.4.0", "scripts": { "postinstall": "gulp prod", "start": "node server.js"