From 0b65e9cd97113cec436ae3ea1d0f957d9830167f Mon Sep 17 00:00:00 2001 From: Fabrice Francois Date: Mon, 11 Sep 2023 10:36:43 -0400 Subject: [PATCH] forward ref for link --- src/components/link/link.tsx | 52 +++++++++++++++++------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/components/link/link.tsx b/src/components/link/link.tsx index 1aebff20c..2bb932b43 100644 --- a/src/components/link/link.tsx +++ b/src/components/link/link.tsx @@ -24,34 +24,30 @@ type LinkType = (typeof LINK_VARIANTS)[number]; * * @param {LinkProps} props - The properties of the link. */ -export const Link: React.FC = ({ - disabled = false, - external = true, - type = 'primary', - iconRight, - description, - label, - href, - ...props -}) => { - return ( - -
- - {iconRight &&
{iconRight}
} -
- {description && {description}} -
- ); -}; +export const Link = React.forwardRef( + ({ disabled = false, external = true, type = 'primary', iconRight, description, label, href, ...props }, ref) => { + return ( + +
+ + {iconRight &&
{iconRight}
} +
+ {description && {description}} +
+ ); + }, +); + +Link.displayName = 'Link'; type StyledLinkProps = Pick & { type: NonNullable;