@lanaco/lnc-react-ui
Version:
React component library
60 lines (59 loc) • 1.84 kB
JavaScript
import { jsx as i, jsxs as g } from "react/jsx-runtime";
import { memo as b, forwardRef as _, useMemo as w } from "react";
import { u as v } from "./useDetectMobile-B0Jog4jQ.js";
import { S as M } from "./index-C_jbF9UW.js";
import C from "./Button.js";
import { W as N } from "./style-BzaX45du.js";
const S = b(M), L = _(
({
buttonText: t,
buttonLink: s,
items: o,
onButtonAction: u = () => {
},
onSelectCard: e = () => {
},
isLoading: j = !1,
limit: z = 4,
getImage: m = () => {
},
isHighlight: p = !1,
componentName: c
}, n) => {
const d = v(), l = w(() => {
var a;
return (a = o == null ? void 0 : o.slice(0, 4)) == null ? void 0 : a.map((r, f) => /* @__PURE__ */ i(
S,
{
uuid: r == null ? void 0 : r.uuid,
title: r == null ? void 0 : r.name,
subtitle: r == null ? void 0 : r.shortDescription,
rating: r == null ? void 0 : r.rating,
reviewCount: r == null ? void 0 : r.reviewCount,
onSelectCard: (B, h) => e == null ? void 0 : e(r == null ? void 0 : r.uuid, h),
image: m(r == null ? void 0 : r.profileImage, r == null ? void 0 : r.uuid) || null,
hideProducts: !0,
metadata: { name: c, accessor: r == null ? void 0 : r.accessor }
},
`shop-card__${f + 1}`
));
}, [o]);
return /* @__PURE__ */ g(N, { ref: n, className: p ? "highlight" : "", children: [
/* @__PURE__ */ i("div", { className: "wrapper__grid", children: l }),
/* @__PURE__ */ i(
C,
{
text: t,
borderRadius: "curved",
btnType: d ? "basic" : "outline",
color: "neutral",
className: "wrapper__action",
onClick: () => u(s)
}
)
] });
}
);
export {
L as default
};