0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 23:42:41 +00:00

Adding the brew title to the print page title, so downloads are named properly

This commit is contained in:
Scott Tolksdorf
2017-03-19 20:23:19 -04:00
parent 28a3f31caa
commit 20371a8b3d
2 changed files with 28 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ const _ = require('lodash');
const cx = require('classnames'); const cx = require('classnames');
const Markdown = require('homebrewery/markdown.js'); const Markdown = require('homebrewery/markdown.js');
const Headtags = require('vitreum/headtags');
const PrintPage = React.createClass({ const PrintPage = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {
@@ -30,7 +32,7 @@ const PrintPage = React.createClass({
} }
if(this.props.query.dialog) window.print(); if(this.props.query.dialog) window.print();
}, },
//TODO: This is pretty bad //TODO: Print page shouldn't replicate functionality in brew renderer
renderStyle : function(){ renderStyle : function(){
if(!this.state.brew.style) return; if(!this.state.brew.style) return;
return <style>{this.state.brew.style.replace(/;/g, ' !important;')}</style> return <style>{this.state.brew.style.replace(/;/g, ' !important;')}</style>
@@ -45,8 +47,17 @@ const PrintPage = React.createClass({
}); });
}, },
renderPrintInstructions : function(){
return <div className='printInstructions'>
Hey, I'm really cool instructions!!!!!
</div>
},
render : function(){ render : function(){
return <div> return <div className='printPage'>
<Headtags.title>{this.state.brew.title}</Headtags.title>
{this.renderPrintInstructions()}
{this.renderStyle()} {this.renderStyle()}
{this.renderPages()} {this.renderPages()}
</div> </div>

View File

@@ -1,3 +1,17 @@
.printPage{
.printPage{
position : relative;
@media print{
.printInstructions{
display : none;
}
}
.printInstructions{
position : absolute;
top : 0px;
right : 0px;
z-index : 100000;
padding : 30px;
background-color : @blue;
}
} }