UNPKG

@lanaco/lnc-react-ui

Version:

React component library

21 lines (20 loc) 782 B
import { jsx as e } from "react/jsx-runtime"; import { forwardRef as c, useRef as f, useEffect as p, Fragment as u } from "react"; import { N as i } from "./NoListingsPhoto-J1mA9RE3.js"; import { l as d } from "./utils-BUdHa0nB.js"; const N = c(({ src: t, ...n }, a) => { const r = f(); return p(() => { var m; const s = (o) => { o.target.src = i, o.onerror = null; }; return (m = r == null ? void 0 : r.current) == null || m.addEventListener("error", s), () => { var o; (o = r == null ? void 0 : r.current) == null || o.removeEventListener("error", s); }; }, []), /* @__PURE__ */ e(u, { ref: a, children: d(t) ? /* @__PURE__ */ e("img", { ref: r, src: t, ...n }) : /* @__PURE__ */ e("img", { src: i, ...n }) }); }); export { N as P };