@anoki/fse-ui
Version:
FSE UI components library
61 lines (60 loc) • 1.75 kB
JavaScript
import { j as r } from "./index.es278.js";
import { ArrowRight as x } from "./index.es22.js";
import { ArrowLeft as j } from "./index.es20.js";
const z = ({
href: f,
asLink: m = "a",
isExternal: n = !1,
fs: p = "6",
children: a,
className: c = "",
onClick: i,
type: d = "button",
asButton: g,
arrowVisible: e = !0,
iconPosition: t = "right",
...l
}) => {
const h = `max-w-fit text-decoration-none text-primary base-row align-items-center fw-bold gap-x8 hover-underline cursor-pointer ${((s) => `fs-${s}`)(p)} ${c}`, o = t === "left" ? j : x;
if (g)
return /* @__PURE__ */ r.jsxs(
"button",
{
className: `bg-transparent border-none ${h}`,
onClick: (s) => {
s.preventDefault(), s.stopPropagation(), i && i();
},
type: d,
...l,
children: [
e && t === "left" && /* @__PURE__ */ r.jsx(o, { color: "primary", width: 24, height: 24 }),
a,
e && t === "right" && /* @__PURE__ */ r.jsx(o, { color: "primary", width: 24, height: 24 })
]
}
);
const u = m;
return /* @__PURE__ */ r.jsxs(
u,
{
className: h,
href: f,
target: n ? "_blank" : void 0,
rel: n ? "noreferrer noopener" : void 0,
...l,
children: [
e && t === "left" && /* @__PURE__ */ r.jsx(o, { color: "primary", width: 24, height: 24 }),
a,
n && /* @__PURE__ */ r.jsxs("span", { className: "visually-hidden", children: [
" ",
"(si apre in una nuova finestra)"
] }),
e && t === "right" && /* @__PURE__ */ r.jsx(o, { color: "primary", width: 24, height: 24 })
]
}
);
};
export {
z as ArrowLink
};
//# sourceMappingURL=index.es21.js.map