UNPKG

@lanaco/lnc-react-ui

Version:

React component library

140 lines (134 loc) 3.29 kB
import { jsxs as i, jsx as m } from "react/jsx-runtime"; import { forwardRef as v, useRef as k } from "react"; import { s as $ } from "./emotion-styled.browser.esm-DfbrHHed.js"; import { n as C, m as z, p as N, G as S, l as p } from "./utils-BUdHa0nB.js"; import { P as j } from "./index-DxYmn1al.js"; const P = $.a` text-decoration: none; color: var(--gray-950); display: flex; flex-direction: column; justify-content: end; position: relative; border-radius: 0.75rem; overflow: hidden; cursor: pointer; background: linear-gradient( 178.16deg, rgba(0, 0, 0, 0) 1.5%, rgba(0, 0, 0, 0) 37.37%, #000000 98.39% ); & .text-block { padding: 0.75rem; z-index: 1; display: flex; flex-direction: column; gap: 0.5rem; position: absolute; bottom: 0rem; left: 0rem; } & .img-wrapper { position: absolute; top: 0; left: 0; z-index: 0; background: linear-gradient( 178deg, rgba(0, 0, 0, 0) 1.5%, rgba(0, 0, 0, 0.16) 8.95%, #000 98.39% ); } & img { width: 100%; aspect-ratio: 1 / 1; /* defining the aspect ratio of the image */ object-fit: cover; /* making sure the image isn't distorted */ border-radius: 0.75rem; mix-blend-mode: multiply; border: 1px solid var(--gray-95008, #14161a14); } & .fallback-image { mix-blend-mode: multiply; } font-size: 0.875rem; font-weight: 500; & .price-chip { font-size: 0.75rem; font-weight: 500; padding: 0 0.38rem; min-height: 1.25rem; max-height: 1.25rem; min-width: fit-content; width: fit-content; display: flex; align-items: center; justify-content: center; border-radius: 62.4375rem; z-index: 1; background-color: var(--white, #fff); color: var(--gray-950, #14161a); white-space: nowrap; } & .title-simple-product-card { z-index: 1; color: var(--white, #fff); transition: all 0.2s ease; ${C(2)} } &:hover { & .title-simple-product-card { z-index: 1; } } `, E = v((f, R) => { const { uuid: t, title: g, price: o = 0, currency: a, isNegotiable: n, isFree: c, image: u, sellerUuid: T, nameSlug: r, onSelectCard: b = () => { }, imageComponent: d, negotiableText: h = "Negotiable", freeText: x = "Free", metadata: e, LinkComponent: s } = f, y = s || "a", l = k(); return /* @__PURE__ */ i( P, { ref: l, className: "simple-product-card", "data-accessor": e == null ? void 0 : e.accessor, name: e == null ? void 0 : e.name, onClick: (w) => b(w, l), as: y, ...s ? { to: `/product/${p(r) ? `${r}-` : ""}${t}` } : { href: `/product/${p(r) ? `${r}-` : ""}${t}` }, children: [ z(d) ? d : /* @__PURE__ */ m(j, { src: u }), /* @__PURE__ */ i("div", { className: "text-block", children: [ /* @__PURE__ */ m("div", { className: "title-simple-product-card", children: g }), /* @__PURE__ */ i("div", { className: "price-chip", children: [ o > 0 && a && n !== !0 && c !== !0 && `${N(o)} ${S(a)}`, n && h, c && x ] }) ] }) ] } ); }); export { E as S };