* 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
28 lines
513 B
JavaScript
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;
|