mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-02 23:42:44 +00:00
renamed render warnings and now built into the brewrenderer
This commit is contained in:
@@ -3,7 +3,7 @@ const React = require('react');
|
||||
const _ = require('lodash');
|
||||
const cx = require('classnames');
|
||||
|
||||
const Warnings = React.createClass({
|
||||
const RenderWarnings = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
warnings: {}
|
||||
@@ -18,21 +18,27 @@ const Warnings = React.createClass({
|
||||
warnings : {
|
||||
chrome : function(){
|
||||
const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
||||
if(isChrome){
|
||||
return 'OPtimized for Chrome';
|
||||
if(!isChrome){
|
||||
return <li key='chrome'>
|
||||
<em>Built for Chrome </em> <br />
|
||||
Other browsers do not support key features this site uses.
|
||||
</li>;
|
||||
}
|
||||
},
|
||||
zoom : function(){
|
||||
if(window.devicePixelRatio !== 1){
|
||||
return 'You are zoomed';
|
||||
return <li key='zoom'>
|
||||
<em>Your browser is zoomed. </em> <br />
|
||||
This can cause content to jump columns.
|
||||
</li>;
|
||||
}
|
||||
}
|
||||
},
|
||||
checkWarnings : function(){
|
||||
this.setState({
|
||||
warnings : _.reduce(this.warnings, (r, fn, type) => {
|
||||
const text = fn();
|
||||
if(text) r[type] = text;
|
||||
const element = fn();
|
||||
if(element) r[type] = element;
|
||||
return r;
|
||||
}, {})
|
||||
})
|
||||
@@ -40,17 +46,13 @@ const Warnings = React.createClass({
|
||||
render: function(){
|
||||
if(_.isEmpty(this.state.warnings)) return null;
|
||||
|
||||
const errors = _.map(this.state.warnings, (text, idx) => {
|
||||
return <li key={idx}>{text}</li>
|
||||
});
|
||||
|
||||
return <div className='warnings'>
|
||||
return <div className='renderWarnings'>
|
||||
<i className='fa fa-exclamation-triangle' />
|
||||
<h3>Rendering Warnings</h3>
|
||||
<h3>Render Warnings</h3>
|
||||
<small>If this homebrew is rendering badly if might be because of the following:</small>
|
||||
<ul>{errors}</ul>
|
||||
<ul>{_.values(this.state.warnings)}</ul>
|
||||
</div>
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Warnings;
|
||||
module.exports = RenderWarnings;
|
||||
@@ -2,19 +2,21 @@
|
||||
.warnings{
|
||||
position : fixed;
|
||||
display : inline-block;
|
||||
top : @navbarHeight;
|
||||
right : 15px;
|
||||
z-index : 10001;
|
||||
width : 350px;
|
||||
padding : 20px;
|
||||
padding-bottom : 10px;
|
||||
padding-left : 100px;
|
||||
right : 0px;
|
||||
top : @navbarHeight;
|
||||
background-color : @orange;
|
||||
padding-left : 85px;
|
||||
background-color : @yellow;
|
||||
color : white;
|
||||
i{
|
||||
position : absolute;
|
||||
left : 30px;
|
||||
opacity : 0.8;
|
||||
font-size : 3em;
|
||||
position: absolute;
|
||||
left: 24px;
|
||||
opacity: 0.8;
|
||||
font-size: 2.5em;
|
||||
top: 24px;
|
||||
}
|
||||
small{
|
||||
opacity : 0.7;
|
||||
@@ -27,10 +29,14 @@
|
||||
ul{
|
||||
margin-top : 15px;
|
||||
font-size : 0.8em;
|
||||
list-style-position : inside;
|
||||
list-style-position : outside;
|
||||
list-style-type : disc;
|
||||
li{
|
||||
line-height : 1.6em;
|
||||
font-size: 0.8em;
|
||||
em{
|
||||
font-weight: 800;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user