Browse Source

[Beta] Open external link in new tab

main
Dan Abramov 2 years ago
parent
commit
5f349ddda7
  1. 5
      beta/src/components/Layout/Sidebar/SidebarLink.tsx
  2. 8
      beta/src/sidebarHome.json

5
beta/src/components/Layout/Sidebar/SidebarLink.tsx

@ -47,11 +47,16 @@ export function SidebarLink({
}
}, [ref, selected]);
let target = '';
if (href.startsWith('https://')) {
target = '_blank';
}
return (
<Link href={href}>
<a
ref={ref}
title={title}
target={target}
aria-current={selected ? 'page' : undefined}
className={cn(
'p-2 pr-2 w-full rounded-none lg:rounded-r-lg text-left hover:bg-gray-5 dark:hover:bg-gray-80 relative flex items-center justify-between',

8
beta/src/sidebarHome.json

@ -11,10 +11,6 @@
"title": "Overview",
"path": "/"
},
{
"title": "Blog",
"path": "https://reactjs.org/blog"
},
{
"title": "Community",
"path": "/community",
@ -25,6 +21,10 @@
"title": "Meet the Team",
"path": "/community/meet-the-team"
}]
},
{
"title": "Blog",
"path": "https://reactjs.org/blog"
}
]
}

Loading…
Cancel
Save