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

25 lines
534 B
React
Raw Normal View History

2021-06-14 15:24:21 +02:00
// @flow
import React from 'react';
import classnames from 'classnames';
import type { Node } from 'react';
import useLazyLoading from 'effects/use-lazy-loading';
type Props = {
thumb: string,
children?: Node,
};
const Thumb = (props: Props) => {
const { thumb, children } = props;
const thumbnailRef = React.useRef(null);
useLazyLoading(thumbnailRef);
return (
<div ref={thumbnailRef} data-background-image={thumb} className={classnames('media__thumb')}>
{children}
</div>
);
};
export default Thumb;