Skip to content

Commit

Permalink
Ensures links from sidebar open in new windows if they're external fa…
Browse files Browse the repository at this point in the history
…cing
  • Loading branch information
elijahbenizzy committed May 9, 2024
1 parent 12df7d1 commit 5db5da6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions telemetry/ui/src/components/nav/appcontainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ export const AppContainer = (props: { children: React.ReactNode }) => {
: 'text-gray-700 hover:text-dwdarkblue hover:bg-gray-50',
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold'
)}
target={item.linkType === 'external' ? '_blank' : undefined}
rel={item.linkType === 'external' ? 'noreferrer' : undefined}
>
<item.icon
className={classNames(
Expand Down Expand Up @@ -250,6 +252,8 @@ export const AppContainer = (props: { children: React.ReactNode }) => {
: 'hover:bg-gray-50',
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold text-gray-700'
)}
target={item.linkType === 'external' ? '_blank' : undefined}
rel={item.linkType === 'external' ? 'noreferrer' : undefined}
>
<item.icon
className="h-6 w-6 shrink-0 text-gray-400"
Expand Down Expand Up @@ -293,6 +297,12 @@ export const AppContainer = (props: { children: React.ReactNode }) => {
: 'hover:bg-gray-50',
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700'
)}
target={
subItem.linkType === 'external' ? '_blank' : undefined
}
rel={
subItem.linkType === 'external' ? 'noreferrer' : undefined
}
>
{subItem.name}
</Link>
Expand Down

0 comments on commit 5db5da6

Please sign in to comment.