import PropTypes from "prop-types";
import ReactImgix, {Background} from "react-imgix";
const BackgroundImgix = ({ src,imgixParams={},className="lazyload", ...props}) => {
    if (imgixParams.width!=null||imgixParams.w!=null){
        let devicePixelRatio=window.devicePixelRatio;
        if (devicePixelRatio<1)devicePixelRatio=1;
        if(imgixParams.width!=null)imgixParams.width=Math.ceil(imgixParams.width/devicePixelRatio);
        if (imgixParams.w!=null)imgixParams.w=Math.ceil(imgixParams.w/devicePixelRatio);
    }
    return (
        <Background className={className} src={src} imgixParams={imgixParams} {...props}></Background>
    )
}
BackgroundImgix.propTypes = {
    src:PropTypes.string.isRequired
}
export default BackgroundImgix;