import classNames from "classnames"; import { ReactNode } from "react"; import { Link } from "react-router-dom"; import { getTrackingProps } from "../../utils/getTrackingProps"; export type Props = { children: ReactNode; href?: string; className?: string; target?: "_blank"; onClick?: React.MouseEventHandler; track?: boolean; // ...rest title?: string; id?: string; role?: string; isAnchor?: boolean; }; export const VuiLinkInternal = ({ ...rest }: Props) => { return ; }; export const VuiLink = ({ children, href, target, onClick, className, track, isAnchor, ...rest }: Props) => { if (!href) { return ( ); } const props: { target?: string; rel?: string; referrerpolicy?: string; title?: string; id?: string; role?: string; } = { ...rest, ...getTrackingProps(track) }; if (target === "_blank") { props.target = target; } // Uncouple from react-router. if (isAnchor) { return ( {children} ); } return ( {children} ); };