UNPKG

@rsc-labs/medusa-store-analytics-v2

Version:
42 lines (41 loc) 2.36 kB
import { jsxs, jsx } from "react/jsx-runtime"; import { Heading, Text } from "@medusajs/ui"; import { Grid, Divider, Box } from "@mui/material"; import { Link } from "react-router-dom"; const VariantsTopTable = ({ tableRows }) => { return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Divider, {}) }), /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "space-between", children: [ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Heading, { level: "h3", children: "Variant" }) }), /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Heading, { level: "h3", children: "Count" }) }) ] }) }), tableRows.length > 0 ? tableRows.map((tableRow) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "space-between", children: [ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Link, { to: `../products/${tableRow.productId}`, children: /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", spacing: 2, children: [ tableRow.thumbnail && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx( Box, { sx: { width: 30, height: 40 }, component: "img", alt: `Thumbnail for ${tableRow.productTitle}`, src: tableRow.thumbnail } ) }), /* @__PURE__ */ jsxs(Grid, { item: true, children: [ tableRow.productTitle, " - ", tableRow.variantTitle ] }) ] }) }) }), /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Text, { children: tableRow.sum }) }) ] }) }, tableRow.productId)) : /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "space-between", children: [ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Text, { children: "None" }) }), /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Text, { children: "None" }) }) ] }) }) ] }); }; export { VariantsTopTable };