File tree Expand file tree Collapse file tree
src/components/Layout/LeftPanel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const LeftPanelItem = (props: LeftPanelItemType) => {
2727 const isItemActive = ( item : MenuItem ) => item . id === active || item ?. children ?. some ( ( subItem ) => subItem . id === active )
2828 const isActive = isItemActive ( item )
2929 const isDisabled = item ?. visibility !== ENABLED
30+ const isExternal = item . link ?. startsWith ( '//' ) || item . link ?. startsWith ( 'http' )
3031
3132 return (
3233 < li className = 'menu-list-item' css = { [ collapsed && styles . menuListItem ] } >
@@ -35,8 +36,10 @@ const LeftPanelItem = (props: LeftPanelItemType) => {
3536 data-test-id = { item . dataTestId }
3637 href = { item . link }
3738 id = { item . id }
38- onClick = { ( e ) => handleItemClick ( item , e ) }
39+ onClick = { isExternal ? undefined : ( e ) => handleItemClick ( item , e ) }
3940 ref = { refs . setReference }
41+ rel = { isExternal ? 'noreferrer' : undefined }
42+ target = { isExternal ? '_blank' : undefined }
4043 >
4144 < div css = { [ styles . itemTitle , isActive && styles . itemTitleActive ] } data-icon = { item . icon } >
4245 { typeof item . icon === 'string' ? < Icon icon = { item . icon } /> : cloneElement ( item . icon as ReactElement , { css : styles . itemTitleIcon } ) }
You can’t perform that action at this time.
0 commit comments