Mailspring/internal_packages/composer-templates/lib/template-status-bar.jsx
Evan Morikawa 1498bcfac6 fix(lint): final linter fixes
fix(lint): final set of linter fixes
2016-05-06 16:32:34 -07:00

37 lines
855 B
JavaScript

import {React} from 'nylas-exports';
class TemplateStatusBar extends React.Component {
static displayName = 'TemplateStatusBar';
static propTypes = {
draft: React.PropTypes.object.isRequired,
};
shouldComponentUpdate(nextProps) {
return (this._usingTemplate(nextProps) !== this._usingTemplate(this.props));
}
_usingTemplate({draft}) {
return draft && draft.body.search(/<code[^>]*class="var[^>]*>/i) > 0;
}
render() {
if (this._usingTemplate(this.props)) {
return (
<div className="template-status-bar">
Press "tab" to quickly move between the blanks - highlighting will not be visible to recipients.
</div>
);
}
return <div></div>;
}
}
TemplateStatusBar.containerStyles = {
textAlign: 'center',
width: 580,
margin: 'auto',
};
export default TemplateStatusBar;