import { Link } from "react-router-dom"; import { determineLink } from "../../../lib/links"; import { modalController } from "../../../controllers/modals/ModalController"; export function RenderAnchor({ href, ...props }: JSX.HTMLAttributes) { // Pass-through no href or if anchor if (!href || href.startsWith("#")) return ; // Determine type of link const link = determineLink(href); if (link.type === "none") return ; // Render direct link if internal if (link.type === "navigate") { return ; } return ( modalController.openLink(href) && ev.preventDefault() } /> ); }