@lanaco/lnc-react-ui
Version:
React component library
124 lines (118 loc) • 2.85 kB
JavaScript
import { jsxs as e, jsx as a } from "react/jsx-runtime";
import { forwardRef as f } from "react";
import { n as o } from "./emotion-styled.browser.esm-CjCaF13H.js";
import { m as u, l as h, n as b, G as x } from "./utils-DtRLzzTZ.js";
const C = o.div`
background-color: var(--gray-200, #dddfe4);
border-radius: 0.75rem;
min-width: 11.625rem;
min-height: 11.625rem;
max-width: 11.625rem;
max-height: 11.625rem;
${u("-90deg")}
`, v = o.div`
display: flex;
flex-direction: column;
justify-content: end;
position: relative;
border-radius: 0.75rem;
overflow: hidden;
cursor: pointer;
background: linear-gradient(
178deg,
rgba(0, 0, 0, 0) 1.5%,
rgba(0, 0, 0, 0.16) 8.95%,
#000 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;
}
& .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;
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);
}
& .title-simple-product-card {
z-index: 1;
color: var(--white, #fff);
transition: all 0.2s ease;
}
&:hover {
& .title-simple-product-card {
z-index: 1;
color: var(--primary-500, #f59e0b);
}
}
`, G = f((d, y) => {
const {
uuid: w,
title: n,
price: r,
currency: i,
isNegotiable: l,
isFree: m,
image: c,
sellerUuid: k,
onSelectCard: s = () => {
},
imageComponent: t,
negotiableText: p = "Negotiable",
freeText: g = "Free"
} = d;
return /* @__PURE__ */ e(v, { className: "simple-product-card", onClick: s, children: [
h(t) ? t : /* @__PURE__ */ a("img", { src: c }),
/* @__PURE__ */ e("div", { className: "text-block", children: [
/* @__PURE__ */ a("div", { className: "title-simple-product-card", children: n }),
/* @__PURE__ */ e("div", { className: "price-chip", children: [
r && i && `${b(r)} ${x(i)}`,
l && p,
m && g
] })
] })
] });
});
export {
C as S,
G as a
};