Skip to content

feat: Mark external links in sidebar with an icon #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/app/docs/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const navItems = [
links: [
{title: 'Overview', href: '/docs/overview'},
{title: 'Quickstart', href: '/docs/quickstart'},
{title: 'Tour', href: '/docs/tour' },
{title: 'Tour', href: '/docs/tour'},
{title: 'Examples', href: '/docs/examples'},
],
},
Expand All @@ -34,11 +34,11 @@ export const navItems = [
},
{title: 'Resources',
links: [
{title: 'Protocol Registry', href: '/proto'},
{title: 'Protocol Registry', href: '/proto', external: true},
{title: 'Write your own Protocol', href: '/docs/protocols/writing'},
{title: 'Awesome List', href: 'https://github.com/n0-computer/awesome-iroh'},
{title: 'FAQ', href: '/docs/faq' },
{title: 'Wasm/Browser Support', href: '/docs/wasm-browser-support' },
{title: 'Awesome List', href: 'https://github.com/n0-computer/awesome-iroh', external: true},
{title: 'FAQ', href: '/docs/faq'},
{title: 'Wasm/Browser Support', href: '/docs/wasm-browser-support'},
],
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/components/Libraries.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Image from 'next/image';
import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid'
import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid';

import {Button} from '@/components/Button';
import {Heading} from '@/components/Heading';
Expand Down
10 changes: 7 additions & 3 deletions src/components/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Link from 'next/link';
import {usePathname} from 'next/navigation';
import clsx from 'clsx';
import {AnimatePresence, motion, useIsPresent} from 'framer-motion';
import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid';

import {useIsInsideMobileNavigation} from '@/components/MobileNavigation';
import {useSectionStore} from '@/components/SectionProvider';
Expand All @@ -29,7 +30,7 @@ function TopLevelNavItem({href, children}) {
);
}

function NavLink({href, tag, active, isAnchorLink = false, children}) {
function NavLink({href, tag, active, isAnchorLink = false, external, children}) {
return (
<Link
href={href}
Expand All @@ -42,7 +43,10 @@ function NavLink({href, tag, active, isAnchorLink = false, children}) {
'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white',
)}
>
<span className="truncate">{children}</span>
<span className="truncate inline-flex">
{children}
{external && <ArrowTopRightOnSquareIcon className="w-4 h-4 mt-1 ml-1" />}
</span>
{tag && (
<Tag variant="small" color="zinc">
{tag}
Expand Down Expand Up @@ -145,7 +149,7 @@ function NavigationGroup({group, className}) {
<ul role="list" className="border-l border-transparent">
{group.links.map((link) => (
<motion.li key={link.href} layout="position" className="relative">
<NavLink href={link.href} active={link.href === pathname}>
<NavLink active={link.href === pathname} {...link}>
{link.title}
</NavLink>
<AnimatePresence mode="popLayout" initial={false}>
Expand Down
Loading