Skip to content

Commit

Permalink
fix(header): hide external link icon for relative links
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed May 21, 2024
1 parent 322a57c commit c2cd87c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/header/src/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ const Header = ({ className, children, links = [] }) => {
key={i}
className="flex items-center justify-between p-1 text-sm text-slate-500 hover:text-slate-600 dark:text-slate-300"
>
{link.title}{' '}
<ArrowTopRightOnSquareIcon className="ml-1 w-4 text-slate-500 dark:text-slate-300" />
{link.title}
{link.actionUrl.url.toLowerCase().startsWith('https') ? (
<>
{' '}
<ArrowTopRightOnSquareIcon className="ml-1 w-4 text-slate-500 dark:text-slate-300" />
</>
) : null}
</a>
))}
</div>
Expand Down
23 changes: 22 additions & 1 deletion packages/header/src/Header.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ export default {
component: Header,
};

const links = [
{
title: 'Getting Started Guide',
actionUrl: {
url: 'https://gis.utah.gov',
},
},
{
title: 'Documentation',
actionUrl: {
url: '/docs',
},
},
{
title: 'Privacy Policy',
actionUrl: {
url: '/privacy',
},
},
];

export const DefaultHeader = {
render: () => <Header />,
render: () => <Header links={links} />,
};

0 comments on commit c2cd87c

Please sign in to comment.