require('./errorBar.less');
const React = require('react');
const _ = require('lodash');
import Dialog from '../../../components/dialog.jsx';
const DISMISS_BUTTON = ;
const ErrorBar = ( props ) => {
let hasOpenError = false;
let hasCloseError = false;
let hasMatchError = false;
const renderErrors = () => {
hasOpenError = false;
hasCloseError = false;
hasMatchError = false;
const errors = _.map(props.errors, (err, idx) => {
if (err.id === 'OPEN') hasOpenError = true;
if (err.id === 'CLOSE') hasCloseError = true;
if (err.id === 'MISMATCH') hasMatchError = true;
return (
Line {err.line} : {err.text}, '{err.type}' tag
);
});
return ;
};
const renderProtip = () => {
const msg = [];
if (hasOpenError) {
msg.push(
An unmatched opening tag means there's an opened tag that isn't closed. You need to close your tags, like this {'
'}. Make sure to match types!
);
}
if (hasCloseError) {
msg.push(
An unmatched closing tag means you closed a tag without opening it. Either remove it, or check to where you think you opened it.
);
}
if (hasMatchError) {
msg.push(
A type mismatch means you closed a tag, but the last open tag was a different type.
);
}
return (
Protips!
{msg}
);
};
if (!props.errors.length) return null;
return (
);
};
module.exports = ErrorBar;