0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-28 09:12:45 +00:00

So much polish

This commit is contained in:
Scott Tolksdorf
2016-01-04 17:02:55 -05:00
parent b1b69437ea
commit fb8ddfe9fa
16 changed files with 146 additions and 62 deletions

View File

@@ -11,8 +11,6 @@ var request = require("superagent");
var EditPage = React.createClass({
getDefaultProps: function() {
return {
//text : "",
pending : false,
id : null,
entry : {
text : "",
@@ -27,10 +25,19 @@ var EditPage = React.createClass({
getInitialState: function() {
return {
text: this.props.entry.text,
pending : false
pending : false,
lastUpdated : this.props.entry.updatedAt
};
},
componentDidMount: function() {
var self = this;
window.onbeforeunload = function(){
if(!self.state.pending) return;
return "You have unsaved changes!";
}
},
handleTextChange : function(text){
this.setState({
text : text,
@@ -45,17 +52,18 @@ var EditPage = React.createClass({
.send({text : this.state.text})
.end((err, res) => {
this.setState({
pending : false
pending : false,
lastUpdated : res.body.updatedAt
})
})
}, 1500),
render : function(){
return <div className='editPage'>
<Statusbar
editId={this.props.entry.editId}
shareId={this.props.entry.shareId}
lastUpdated={this.state.lastUpdated}
isPending={this.state.pending} />
<div className='paneSplit'>
@@ -66,9 +74,6 @@ var EditPage = React.createClass({
<PHB text={this.state.text} />
</div>
</div>
</div>
}
});

View File

@@ -1,24 +1,5 @@
.editPage{
.paneSplit{
width : 100%;
max-height: 100%;
.leftPane, .rightPane{
display: inline-block;
vertical-align: top;
position: relative;
min-height: 100%;
}
.leftPane{
width : 40%;
}
.rightPane{
width : 60%;
overflow-y: scroll;
}
}
}

View File

@@ -55,6 +55,11 @@ var Icons = [
icon : 'fa-arrows-v',
snippet : "<div style='margin-top:140px'></div>\n\n",
tooltip : "Vertical Spacing"
},
{
icon : 'fa-image',
snippet : "<img />",
tooltip : "Insert Image"
}
@@ -68,6 +73,10 @@ var Editor = React.createClass({
};
},
componentDidMount: function() {
this.refs.textarea.focus();
},
handleTextChange : function(e){
this.props.onChange(e.target.value);
},

View File

@@ -4,11 +4,13 @@
height : 100%;
min-height : 100%;
width : 100%;
display: flex;
flex-direction: column;
.textIcons{
position : absolute;
display : inline-block;
vertical-align : top;
.icon{
display : inline-block;
height : 30px;
width : 30px;
cursor : pointer;
@@ -26,10 +28,13 @@
}
}
textarea{
display : inline-block;
box-sizing : border-box;
resize : none;
overflow-y : scroll;
height : 100%;
width : 100%;
padding : 10px;
border : none;
outline: none;
}
}

View File

@@ -12,7 +12,7 @@ var HomePage = React.createClass({
getInitialState: function() {
return {
text: "# Welcome"
text: "# Welcome \n Katie help me decide what should go here."
};
},
@@ -38,8 +38,18 @@ var HomePage = React.createClass({
return(
<div className='homePage'>
<Statusbar />
<Editor text={this.state.text} onChange={this.handleTextChange} />
<PHB text={this.state.text} />
<div className='paneSplit'>
<div className='leftPane'>
<Editor text={this.state.text} onChange={this.handleTextChange} />
</div>
<div className='rightPane'>
<PHB text={this.state.text} />
</div>
</div>
<a href='/homebrew/new' className='floatingNewButton'>
Create your own <i className='fa fa-magic' />
</a>
</div>
);
}

View File

@@ -1,3 +1,20 @@
.homePage{
.homePage{
position : relative;
a.floatingNewButton{
.animate(background-color);
position : absolute;
display : block;
right : 70px;
bottom : 70px;
padding : 1em;
background-color : @orange;
font-size : 1.5em;
color : white;
text-decoration : none;
box-shadow : 3px 3px 15px black;
&:hover{
background-color : darken(@orange, 20%);
}
}
}

View File

@@ -12,4 +12,31 @@ html,body, #reactContainer{
.homebrew{
background-color: @steel;
height : 100%;
.paneSplit{
width : 100%;
height: 100vh;
padding-top: 25px;
position: relative;
box-sizing: border-box;
.leftPane, .rightPane{
display: inline-block;
vertical-align: top;
position: relative;
height: 100%;
min-height: 100%;
}
.leftPane{
width : 40%;
}
.rightPane{
width : 60%;
height: 100%;
overflow-y: scroll;
}
}
}

View File

@@ -1,11 +1,12 @@
.pbhPages{
background-color: @steel;
padding : 40px 0px;
padding : 30px 0px;
&>.phb{
box-shadow : 1px 4px 14px #000;
margin-left: auto;
margin-right: auto;
margin-bottom: 30px;
}
}
@font-face {
@@ -72,7 +73,7 @@
position : relative;
overflow: hidden;
//Accents
//Page Accents
&:after{
content : "";
position: absolute;
@@ -85,8 +86,8 @@
background-image : url('/assets/homebrew/assets/accent.png');
}
p,ul,blockquote{
//Avoid breaking up
p,ul,blockquote,table{
-webkit-column-break-inside : avoid;
-moz-column-break-inside : avoid;
-o-column-break-inside : avoid;
@@ -338,7 +339,7 @@
&+p{
&::first-letter{
float: left;
margin-top: 0.3em;
margin-top: 0.4em;
margin-bottom: 0.4em;
font-family: Solbera;
font-size: 10em;

View File

@@ -24,9 +24,8 @@ var SharePage = React.createClass({
return(
<div className='sharePage'>
<Statusbar
shareId={this.props.entry.shareId}
/>
lastUpdated={this.props.entry.updatedAt}
/>
<PHB text={this.props.entry.text} />
</div>

View File

@@ -1,6 +1,7 @@
var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
var Moment = require('moment');
var Logo = require('naturalCrit/logo/logo.jsx');
@@ -14,6 +15,8 @@ var Statusbar = React.createClass({
shareId : null,
isPending : false,
lastUpdated : null,
info : null
};
},
@@ -23,8 +26,11 @@ var Statusbar = React.createClass({
},
renderInfo : function(){
//render last update?
//number of times viewed?
if(!this.props.lastUpdated) return null;
return <div className='lastUpdated'>
Last updated: {Moment(this.props.lastUpdated).fromNow()}
</div>
},
renderNewButton : function(){
@@ -36,6 +42,8 @@ var Statusbar = React.createClass({
},
renderEdit : function(){
return null;
if(!this.props.editId) return null;
return <div className='editField' key='edit' onClick={this.selectInputText.bind(this, 'edit')}>
@@ -47,10 +55,9 @@ var Statusbar = React.createClass({
renderShare : function(){
if(!this.props.shareId) return null;
return <div className='shareField' key='share' onClick={this.selectInputText.bind(this, 'share')}>
<span>Share Link</span>
<input type='text' readOnly value={'/homebrew/share/' + this.props.shareId} ref='share'/>
</div>
return <a className='shareField' key='share' href={'/homebrew/share/' + this.props.shareId} target="_blank">
Share Link <i className='fa fa-external-link' />
</a>
},
renderStatus : function(){
@@ -71,17 +78,16 @@ var Statusbar = React.createClass({
<Logo />
<div className='left'>
<div className='toolName'>
Home<i className='fa fa-beer fa-flip-horizontal' /><small>rewery</small>
</div>
<a href='/homebrew' className='toolName'>
The Home<i className='fa fa-beer fa-flip-horizontal' /><small>rewery</small>
</a>
</div>
<div className='controls right'>
{this.renderStatus()}
{this.renderEdit()}
{this.renderInfo()}
{this.renderShare()}
{this.renderNewButton()}
</div>
</div>

View File

@@ -1,18 +1,26 @@
.statusbar{
height : 1.0em;
height : 25px;
background-color : black;
font-size : 24px;
position: fixed;
width :100%;
z-index : 1000;
color : white;
line-height : 1.0em;
border-bottom : 1px solid @grey;
.logo{
display : inline-block;
vertical-align : middle;
margin-right : 40px;
margin-right : 20px;
margin-top: -5px;
svg{
margin-top: -6px;
}
}
.left{
display : inline-block;
vertical-align: top;
}
.right{
float : right;
@@ -20,8 +28,11 @@
.toolName{
vertical-align : middle;
font-family : CodeBold;
text-decoration: none;
color: white;
display: block;
font-size : 16px;
line-height : 100%;
line-height : 30px;
small{
font-family : CodeBold;
}
@@ -44,10 +55,17 @@
color : white;
text-decoration : none;
&:hover{
background-color : rgba(255,0,0,0.4);
background-color : fade(@green, 70%);
}
}
.editField, .shareField{
.shareField{
color : white;
text-decoration : none;
cursor : pointer;
.animate(background-color);
&:hover{
background-color : fade(@teal, 70%);
}
span{
margin-right : 10px;
}