diff --git a/src/components/Logo/Logo.tsx b/src/components/Logo/Logo.tsx index 84b4e09f..56d21222 100644 --- a/src/components/Logo/Logo.tsx +++ b/src/components/Logo/Logo.tsx @@ -18,6 +18,7 @@ export const Logo: React.FC = ({ iconSize = 24, textSize = 15, href, + target = '_self', wrapper, onClick, }) => { @@ -43,7 +44,8 @@ export const Logo: React.FC = ({ className={b('btn-logo')} component={hasWrapper ? 'span' : undefined} onClick={onClick} - target="_self" + target={target} + rel={target === '_self' ? undefined : 'noreferrer'} href={href} > {buttonIcon} @@ -73,7 +75,8 @@ export const Logo: React.FC = ({ ) : ( diff --git a/src/components/MobileLogo/MobileLogo.tsx b/src/components/MobileLogo/MobileLogo.tsx index 7bab9ef4..3229af43 100644 --- a/src/components/MobileLogo/MobileLogo.tsx +++ b/src/components/MobileLogo/MobileLogo.tsx @@ -22,6 +22,7 @@ export const MobileLogo: React.FC = ({ iconSize = 32, textSize = 20, href = '/', + target = '_self', wrapper, onClick, }) => { @@ -31,7 +32,8 @@ export const MobileLogo: React.FC = ({ const linkProps = hasClickHandler ? {} : { - target: '_self', + target, + ref: target === '_self' ? undefined : 'noreferrer', href, }; diff --git a/src/components/types.ts b/src/components/types.ts index 7c7b24e5..e4e2f6f8 100644 --- a/src/components/types.ts +++ b/src/components/types.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {HTMLAttributeAnchorTarget} from 'react'; import {AlertProps, IconProps} from '@gravity-ui/uikit'; @@ -65,6 +65,7 @@ export interface LogoProps { iconSize?: number; textSize?: number; href?: string; + target?: HTMLAttributeAnchorTarget; wrapper?: (node: React.ReactNode, compact: boolean) => React.ReactNode; onClick?: (event: React.MouseEvent) => void; }