From a81adfc5ecc43550395dd7f1cd83049ee297d647 Mon Sep 17 00:00:00 2001 From: gitstart Date: Tue, 16 May 2023 08:32:01 +0000 Subject: [PATCH] chore: fixes LinkButton v2 Co-authored-by: oxenprogrammer <7220167+oxenprogrammer@users.noreply.github.com> Co-authored-by: raph941 <45232708+raph941@users.noreply.github.com> --- .../src/v2/LinkButton/LinkButton.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/strapi-design-system/src/v2/LinkButton/LinkButton.tsx b/packages/strapi-design-system/src/v2/LinkButton/LinkButton.tsx index cbeb6683f..a67528942 100644 --- a/packages/strapi-design-system/src/v2/LinkButton/LinkButton.tsx +++ b/packages/strapi-design-system/src/v2/LinkButton/LinkButton.tsx @@ -42,11 +42,23 @@ const LinkWrapper = styled(BaseButtonWrapper)` export const LinkButton = React.forwardRef( ( - { variant = 'default', startIcon, endIcon, disabled = false, children, size = 'S', as = BaseLink, ...props }, + { + variant = 'default', + startIcon, + endIcon, + disabled = false, + children, + isExternal, + size = 'S', + as = BaseLink, + ...props + }, ref, ) => { const paddingX = size === 'S' ? 2 : '10px'; const paddingY = 4; + const target = isExternal ? '_blank' : undefined; + const rel = isExternal ? 'noreferrer noopener' : undefined; return ( ( paddingRight={paddingY} paddingTop={paddingX} pointerEvents={disabled ? 'none' : undefined} + target={target} + rel={rel} {...props} as={as || BaseLink} >