@lanaco/lnc-react-ui
Version:
React component library
217 lines (200 loc) • 5.17 kB
JavaScript
import { jsxs as h, jsx as o } from "react/jsx-runtime";
import { forwardRef as m } from "react";
import u from "./Button.js";
import { s as _ } from "./emotion-styled.browser.esm-DfbrHHed.js";
import { d as i } from "./breakpoints-BubDitvo.js";
import { S as p } from "./index-CsBUrEws.js";
const x = _.a`
text-decoration: none;
color: var(--gray-950);
display: flex;
height: 28.75rem;
padding: 2.25rem;
align-items: flex-start;
flex-direction: column;
justify-content: space-between;
cursor: pointer;
width: 100%;
min-width: 0;
background: ${(r) => r == null ? void 0 : r.backgroundColor}, url("${(r) => r == null ? void 0 : r.backgroundImage}");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
border-radius: 0.75rem;
transition: transform 0.3s ease, box-shadow 0.3s ease;
&:hover {
transform: scale(1.02);
box-shadow: 0 4px 24px rgba(20, 22, 26, 0.12);
}
& .section__text {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 1rem;
align-self: stretch;
& .section__title {
color: var(--white, #fff);
font-size: 1rem;
font-style: normal;
font-weight: 500;
line-height: 1.5rem;
}
& .section__description {
color: var(--white, #fff);
font-size: 1.375rem;
font-style: normal;
font-weight: 600;
line-height: 1.75rem;
}
}
& .section__action {
background: var(--white, #fff);
color: var(--gray-950, #14161a);
font-size: 0.875rem;
font-style: normal;
font-weight: 500;
line-height: 1.25rem;
&:hover {
color: var(--gray-700, #4e555f);
}
&:focus {
outline: none;
}
}
@media ${i("S")} {
padding: 2rem;
min-height: 17.5rem;
height: auto;
& .section__text {
gap: 0.5rem;
& .section__title {
font-size: 0.875rem;
line-height: 1.25rem;
}
& .section__description {
font-size: 1rem;
line-height: 1.5rem;
}
}
}
`, v = m(
({
title: r,
description: n,
buttonText: s,
imageUrl: l,
backgroundColor: c = "none",
handleSelectCard: d = () => {
},
handleButtonAction: f = () => {
},
selectAction: a,
LinkComponent: e
}, g) => /* @__PURE__ */ h(
x,
{
ref: g,
backgroundImage: l,
backgroundColor: c,
onClick: d,
as: e || "a",
...e ? {
to: `/${a}`
} : {
href: `/${a}`
},
children: [
/* @__PURE__ */ h("div", { className: "section__text", children: [
r && /* @__PURE__ */ o("div", { className: "section__title", children: r }),
n && /* @__PURE__ */ o("div", { className: "section__description", children: n })
] }),
/* @__PURE__ */ o(
u,
{
text: s,
onClick: (t) => {
t == null || t.preventDefault(), t == null || t.stopPropagation(), f();
},
borderRadius: "regular",
color: "gray",
className: "section__action"
}
)
]
}
)
), y = _.div`
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 1.5rem;
& .section__title {
color: var(--gray-950, #14161a);
font-size: 1.5rem;
font-style: normal;
font-weight: 600;
line-height: 2rem;
letter-spacing: -0.0294rem;
}
& .section__items {
display: grid;
grid-template-columns: repeat(${(r) => r == null ? void 0 : r.numOfColumns}, 1fr);
gap: 1rem;
width: 100%;
}
@media ${i("M")} {
& .section__items {
grid-template-columns: repeat(2, 1fr);
}
}
@media ${i("S")} {
& .section__title {
font-size: 1.375rem;
line-height: 1.75rem;
}
}
@media ${i("XS")} {
& .section__items {
grid-template-columns: 1fr;
}
}
`, N = m(
({
title: r,
items: n,
isLoading: s = !1,
numOfColumns: l = 4,
onSelectCard: c = () => {
},
onButtonAction: d = () => {
},
LinkComponent: f
}, a) => /* @__PURE__ */ h(y, { ref: a, numOfColumns: l, className: "lp-section lp-overlay-general-cards-section", children: [
/* @__PURE__ */ o("div", { className: "section__title", children: r }),
/* @__PURE__ */ o(
p,
{
isLoading: s,
keyPrefix: "overlay-general-cards-skeleton",
children: /* @__PURE__ */ o("div", { className: "section__items", children: n == null ? void 0 : n.map((e, g) => /* @__PURE__ */ o(
v,
{
title: e == null ? void 0 : e.title,
description: e == null ? void 0 : e.description,
imageUrl: e == null ? void 0 : e.imageUrl,
buttonText: e == null ? void 0 : e.buttonText,
backgroundColor: e == null ? void 0 : e.backgroundColor,
handleSelectCard: () => c(e),
handleButtonAction: () => d(e),
selectAction: e == null ? void 0 : e.selectAction,
LinkComponent: f
},
`overlay-general-card__${g + 1}`
)) })
}
)
] })
);
export {
N as default
};