Skip to content

Commit

Permalink
🐛 Add remote support for header tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
macdonst committed Nov 9, 2020
1 parent 6fc307d commit 88bcb8d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import Menu from '@spectrum-icons/workflow/ShowMenu'

import { useMediaQuery } from 'react-responsive'
import isExternal from 'is-url-external'

const stretched = css`
height: 100%;
Expand Down Expand Up @@ -185,15 +186,23 @@ const Header = ({
}
: { className: 'spectrum-Tabs-item' }

return (
const label = (
<span className='spectrum-Tabs-itemLabel'>{title}</span>
)

return isExternal(path) ? (
<a href={path} className='spectrum-Tabs-item'>
{label}
</a>
) : (
<Link
key={i}
to={path}
ref={ref}
partiallyActive
getProps={isActive}
>
<span className='spectrum-Tabs-itemLabel'>{title}</span>
{label}
</Link>
)
})}
Expand Down

0 comments on commit 88bcb8d

Please sign in to comment.