'use client' import { forwardRef } from 'react' import Box from '@mui/material/Box' import { alpha, useTheme } from '@mui/material/styles' import { LazyLoadImage as ReactLazyLoadImage } from 'react-lazy-load-image-component' import { LazyLoadImageProps } from './types' import { getRatio } from './utils' export type * from './types' const LazyLoadImage = forwardRef( ( { ratio, overlay, disabledEffect = false, alt, src, afterLoad, delayTime, threshold, beforeLoad, delayMethod, placeholder, wrapperProps, scrollPosition, effect = 'blur', visibleByDefault, wrapperClassName, useIntersectionObserver, sx, ...other }, ref, ) => { const theme = useTheme() const overlayStyles = !!overlay && { '&:before': { content: "''", top: 0, left: 0, width: 1, height: 1, zIndex: 1, position: 'absolute', background: overlay || alpha(theme.palette.grey[900], 0.48), }, } const content = ( ) return ( {content} ) }, ) export default LazyLoadImage