lbry-desktop/ui/component/fileThumbnail/FreezeframeWrapper.jsx

32 lines
790 B
React
Raw Permalink Normal View History

import React, { useEffect } from 'react';
2020-05-28 19:07:04 +02:00
import classnames from 'classnames';
import PropTypes from 'prop-types';
import Freezeframe from './FreezeframeLite';
const FreezeframeWrapper = props => {
const imgRef = React.useRef();
const freezeframe = React.useRef();
// eslint-disable-next-line
const { src, className, children } = props;
useEffect(() => {
freezeframe.current = new Freezeframe(imgRef.current);
}, []);
return (
2020-05-28 19:07:04 +02:00
<div className={classnames(className, 'freezeframe-wrapper')}>
<>
<img ref={imgRef} src={src} className="freezeframe-img" />
{children}
</>
</div>
);
};
FreezeframeWrapper.propTypes = {
src: PropTypes.string.isRequired,
className: PropTypes.string.isRequired,
};
export default FreezeframeWrapper;