@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
23 lines (22 loc) • 593 B
JavaScript
import { jsx } from "react/jsx-runtime";
//#region src/awesome/landingLink.tsx
const isExternalHref = (href) => /^[a-z][\d+.a-z-]*:/i.test(href);
const renderLandingLink = (renderLink, { external, href, ...props }) => {
const isExternal = external ?? isExternalHref(href);
if (renderLink) return renderLink({
...props,
external: isExternal,
href
});
return /* @__PURE__ */ jsx("a", {
href,
...isExternal ? {
rel: "noreferrer",
target: "_blank"
} : {},
...props
});
};
//#endregion
export { isExternalHref, renderLandingLink };
//# sourceMappingURL=landingLink.mjs.map