diff --git a/ui/components/Link.tsx b/ui/components/Link.tsx index 80a8d6a04f..a19cd3bac8 100644 --- a/ui/components/Link.tsx +++ b/ui/components/Link.tsx @@ -9,7 +9,6 @@ import Text, { TextProps } from "./Text"; type Props = { className?: string; to?: string; - innerRef?: any; children?: any; href?: any; target?: any; @@ -28,19 +27,22 @@ const SpacedIcon = ({ icon }: { icon: JSX.Element }) => ( ); -function Link({ - children, - href, - className, - to = "", - newTab, - onClick, - textProps, - icon, - onMouseEnter, - onMouseLeave, - ...props -}: Props) { +const Link = React.forwardRef(function Link( + { + children, + href, + className, + to = "", + newTab, + onClick, + textProps, + icon, + onMouseEnter, + onMouseLeave, + ...props + }, + ref +) { if ((href && !isAllowedLink(href)) || (!href && !to)) { return ( @@ -58,6 +60,7 @@ function Link({ if (href) { return ( ); -} +}); -export default styled(Link).attrs({ className: Link.name })` +Link.displayName = "Link"; + +export default styled(Link).attrs({ className: Link.displayName })` text-decoration: none; `; diff --git a/ui/components/Nav.tsx b/ui/components/Nav.tsx index db5cdcf9be..4b46593dca 100644 --- a/ui/components/Nav.tsx +++ b/ui/components/Nav.tsx @@ -130,7 +130,7 @@ const LinkTabIcon = ({ iconType, color, collapsed, title }) => { else return ; }; -const LinkTab = React.forwardRef((p: any, ref) => { +const LinkTab = React.forwardRef((p, ref) => { const [hovered, setHovered] = React.useState(false); const item: NavItem = p.navItem; @@ -147,7 +147,7 @@ const LinkTab = React.forwardRef((p: any, ref) => { return ( ( - +const ForwardedLink = React.forwardRef((props, ref) => ( + )); function findChildren(childrenProp: any[]) {