mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-01 15:12:40 +00:00
linting
This commit is contained in:
@@ -7,49 +7,49 @@ import Dialog from '../../../components/dialog.jsx';
|
||||
|
||||
const DISMISS_BUTTON = <i className='fas fa-times dismiss' />;
|
||||
|
||||
const ErrorBar = (props) => {
|
||||
let hasOpenError = false, hasCloseError = false, hasMatchError = false;
|
||||
const ErrorBar = (props)=>{
|
||||
let hasOpenError = false, hasCloseError = false, hasMatchError = false;
|
||||
|
||||
const renderErrors = () => (
|
||||
<ul>
|
||||
{_.map(props.errors, (err, idx) => {
|
||||
if (err.id === 'OPEN') hasOpenError = true;
|
||||
if (err.id === 'CLOSE') hasCloseError = true;
|
||||
if (err.id === 'MISMATCH') hasMatchError = true;
|
||||
return (
|
||||
<li key={idx}>
|
||||
const renderErrors = ()=>(
|
||||
<ul>
|
||||
{_.map(props.errors, (err, idx)=>{
|
||||
if(err.id === 'OPEN') hasOpenError = true;
|
||||
if(err.id === 'CLOSE') hasCloseError = true;
|
||||
if(err.id === 'MISMATCH') hasMatchError = true;
|
||||
return (
|
||||
<li key={idx}>
|
||||
Line {err.line} : {err.text}, '{err.type}' tag
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
|
||||
const renderProtip = () => (
|
||||
<div className="protips">
|
||||
<h4>Protips!</h4>
|
||||
{hasOpenError && <div>Unmatched opening tag. Close your tags, like this {'</div>'}. Match types!</div>}
|
||||
{hasCloseError && <div>Unmatched closing tag. Either remove it or check where it was opened.</div>}
|
||||
{hasMatchError && <div>Type mismatch. Closed a tag with a different type.</div>}
|
||||
</div>
|
||||
);
|
||||
const renderProtip = ()=>(
|
||||
<div className='protips'>
|
||||
<h4>Protips!</h4>
|
||||
{hasOpenError && <div>Unmatched opening tag. Close your tags, like this {'</div>'}. Match types!</div>}
|
||||
{hasCloseError && <div>Unmatched closing tag. Either remove it or check where it was opened.</div>}
|
||||
{hasMatchError && <div>Type mismatch. Closed a tag with a different type.</div>}
|
||||
</div>
|
||||
);
|
||||
|
||||
if (!props.errors.length) return null;
|
||||
if(!props.errors.length) return null;
|
||||
|
||||
|
||||
return (
|
||||
<Dialog className="errorBar" closeText={DISMISS_BUTTON} >
|
||||
<div className="content">
|
||||
<i className="fas fa-exclamation-triangle" />
|
||||
<h3> There are HTML errors in your markup</h3>
|
||||
return (
|
||||
<Dialog className='errorBar' closeText={DISMISS_BUTTON} >
|
||||
<div>
|
||||
<i className='fas fa-exclamation-triangle' />
|
||||
<h2> There are HTML errors in your markup</h2>
|
||||
<small>
|
||||
If these aren't fixed your brew will not render properly when you print it to PDF or share it
|
||||
</small>
|
||||
{renderErrors()}
|
||||
</div>
|
||||
<hr />
|
||||
{renderProtip()}
|
||||
</Dialog>
|
||||
<hr />
|
||||
{renderProtip()}
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user