@adyen/adyen-platform-experience-web
Version:

41 lines (40 loc) • 1.15 kB
JavaScript
import { jsx as e } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
import s from "../Typography/Typography.js";
import { TypographyVariant as c, TypographyElement as k } from "../Typography/types.js";
import y from "classnames";
import { useCallback as u } from "../../../external/preact/hooks/dist/hooks.module.js";
/* empty css */
import { Icon as d } from "../Icon/Icon.js";
function C({
href: n,
children: o,
variant: r = "default",
truncate: t,
target: a = "_blank",
withIcon: p = !0,
classNames: l = [],
...i
}) {
const m = u((f) => f.stopPropagation(), []);
return /* @__PURE__ */ e(
"a",
{
className: y("adyen-pe-link", [...l], {
[`adyen-pe-link--${r}`]: r !== "default",
"adyen-pe-link--truncate": t
}),
href: n,
target: a,
rel: "noopener noreferrer",
onClick: m,
...i,
children: [
/* @__PURE__ */ e(s, { className: "adyen-pe-link__text", el: k.SPAN, variant: c.BODY, children: o }),
p && a === "_blank" && /* @__PURE__ */ e(d, { name: "external-link" })
]
}
);
}
export {
C as default
};