| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 2x 1x 2x 2x | import PropTypes from 'prop-types';
import React from 'react';
import style from './image.css';
const Image = ({src, alt, visible, height, width, ...rest}) => {
return (
<img
{...rest}
className={style.image}
src={visible ? src : null}
alt={alt}
style={{
display: visible ? null : 'none',
}}
/>
);
};
Image.propTypes = {
src: PropTypes.string.isRequired,
alt: PropTypes.string,
visible: PropTypes.bool,
};
Image.defaultProps = {
alt: '',
visible: true,
};
export default Image;
|