import { Icon, Icons } from "components/Icon";
import { Link as LinkRouter } from "react-router-dom";
interface IArrowLinkPropsBase {
linkText: string;
className?: string;
onClick?: () => void;
direction?: "left" | "right";
}
interface IArrowLinkPropsExternal extends IArrowLinkPropsBase {
url: string;
}
interface IArrowLinkPropsInternal extends IArrowLinkPropsBase {
to: string;
}
export type ArrowLinkProps =
| IArrowLinkPropsExternal
| IArrowLinkPropsInternal
| IArrowLinkPropsBase;
export function ArrowLink(props: ArrowLinkProps) {
const direction = props.direction || "right";
const isExternal = !!(props as IArrowLinkPropsExternal).url;
const isInternal = !!(props as IArrowLinkPropsInternal).to;
const content = (
{direction === "left" ? (
) : null}
{props.linkText}
{direction === "right" ? (
) : null}
);
if (isExternal)
return {content};
else if (isInternal)
return (
{content}
);
return (
props.onClick && props.onClick()}>{content}
);
}