docbrown/app/javascript/article-form/elements/mainImage.jsx
Tamas Fodor 0d2506f9ef Fix eslint issues in article-form's jsx files (#4217)
* fix eslint issues in article-form's jsx files

* Use e.key instead of deprecated e.keyCode

* Put back whitespace but in html format

* use re-usable SetupImageButton comp, use window.confirm, put back console.log temporarily

* import deep

* fix CoverImage className prop issue

* update jest snap files

* remove no-restricted-globals from eslint-disable-next-line
2019-10-19 17:09:06 -04:00

28 lines
513 B
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
const MainImage = ({ mainImage, onEdit }) => (
<div
className="articleform__mainimage"
role="presentation"
onClick={onEdit}
onKeyUp={e => {
if (e.key === 'Enter') {
onEdit(e);
}
}}
>
<img src={mainImage} alt="" />
</div>
);
MainImage.defaultProps = {
onEdit: () => {},
};
MainImage.propTypes = {
mainImage: PropTypes.string.isRequired,
onEdit: PropTypes.func,
};
export default MainImage;