@lanaco/lnc-react-ui
Version:
React component library
2 lines (1 loc) • 618 B
JavaScript
;const o=require("react/jsx-runtime"),t=require("react"),u=require("./NoListingsPhoto-B6zrIBwB.cjs"),g=require("./utils-BK6B_Y9X.cjs"),d=t.forwardRef(({src:n,...s},a)=>{const r=t.useRef();return t.useEffect(()=>{var c;const i=e=>{e.target.src=u.NoListingsPhoto,e.onerror=null};return(c=r==null?void 0:r.current)==null||c.addEventListener("error",i),()=>{var e;(e=r==null?void 0:r.current)==null||e.removeEventListener("error",i)}},[]),o.jsx(t.Fragment,{ref:a,children:g.isDefinedNotEmptyString(n)?o.jsx("img",{ref:r,src:n,...s}):o.jsx("img",{src:u.NoListingsPhoto,...s})})});exports.ProductImageWrapper=d;