2019-10-06 01:47:08 -04:00
|
|
|
import React, { useEffect } from 'react';
|
2020-05-28 13:07:04 -04:00
|
|
|
import classnames from 'classnames';
|
2019-10-06 01:47:08 -04:00
|
|
|
import PropTypes from 'prop-types';
|
2019-10-07 01:22:04 -04:00
|
|
|
import Freezeframe from './FreezeframeLite';
|
2019-10-06 01:47:08 -04:00
|
|
|
|
2021-02-16 16:09:20 -05:00
|
|
|
const FreezeframeWrapper = (props) => {
|
2019-10-06 01:47:08 -04:00
|
|
|
const imgRef = React.useRef();
|
|
|
|
const freezeframe = React.useRef();
|
2020-08-04 13:50:33 -04:00
|
|
|
// eslint-disable-next-line
|
|
|
|
const { src, className, children } = props;
|
2019-10-06 01:47:08 -04:00
|
|
|
|
|
|
|
useEffect(() => {
|
2019-10-07 01:22:04 -04:00
|
|
|
freezeframe.current = new Freezeframe(imgRef.current);
|
|
|
|
}, []);
|
2019-10-06 01:47:08 -04:00
|
|
|
|
|
|
|
return (
|
2020-05-28 13:07:04 -04:00
|
|
|
<div className={classnames(className, 'freezeframe-wrapper')}>
|
2020-08-04 13:50:33 -04:00
|
|
|
<>
|
|
|
|
<img ref={imgRef} src={src} className="freezeframe-img" />
|
|
|
|
{children}
|
|
|
|
</>
|
2019-10-06 01:47:08 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
FreezeframeWrapper.propTypes = {
|
|
|
|
src: PropTypes.string.isRequired,
|
|
|
|
className: PropTypes.string.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default FreezeframeWrapper;
|