@lanaco/lnc-react-ui
Version:
React component library
68 lines (67 loc) • 2.06 kB
JavaScript
import { jsx as i, jsxs as h } from "react/jsx-runtime";
import { memo as N, forwardRef as M, useMemo as P } from "react";
import { u as _ } from "./useDetectMobile-B0Jog4jQ.js";
import { S as w } from "./index-BDBTaPXr.js";
import y from "./Button.js";
import { W as U } from "./style-BzaX45du.js";
const j = N(w), C = M(
({
buttonText: a,
buttonLink: c,
items: r,
onButtonAction: t = () => {
},
onSelectCard: o = () => {
},
getImage: u = () => {
},
isHighlight: l = !1,
componentName: d,
LinkComponent: m
}, p) => {
const n = _(), f = P(() => {
var s;
return (s = r == null ? void 0 : r.slice(0, 4)) == null ? void 0 : s.map((e, g) => /* @__PURE__ */ i(
j,
{
title: e == null ? void 0 : e.name,
price: e == null ? void 0 : e.price,
isFree: e == null ? void 0 : e.isFree,
isNegotiable: e == null ? void 0 : e.isNegotiable,
currency: e == null ? void 0 : e.currency,
sellerUuid: e == null ? void 0 : e.sellerUuid,
uuid: e == null ? void 0 : e.uuid,
onSelectCard: (v, b) => o == null ? void 0 : o(e == null ? void 0 : e.uuid, b),
image: u(e == null ? void 0 : e.image, e == null ? void 0 : e.uuid, e == null ? void 0 : e.sellerUuid) || null,
metadata: { name: d, accessor: e == null ? void 0 : e.accessor },
LinkComponent: m
},
g
));
}, [r]);
return /* @__PURE__ */ h(
U,
{
ref: p,
className: `blog-product-cards-section ${l ? "highlight" : ""}`,
children: [
/* @__PURE__ */ i("div", { className: "wrapper__grid", children: f }),
/* @__PURE__ */ i(
y,
{
text: a,
borderRadius: "curved",
btnType: n ? "basic" : "outline",
color: "neutral",
className: "wrapper__action",
onClick: () => t(c)
}
)
]
}
);
}
);
export {
C as default
};