Skip to content

Commit

Permalink
(Enhancement) Differenciate external links in the docs sidebar (json-…
Browse files Browse the repository at this point in the history
…schema-org#956)

* (Enhancement) Differenciate external links in the docs sidebar

Fixes json-schema-org#942

* Enhancement: Differentiate External Links

Added an external svg instead of embedding it inline
  • Loading branch information
iamAyushChamoli authored Sep 23, 2024
1 parent d216812 commit 014026c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SegmentHeadline } from './Layout';
import extractPathWithoutFragment from '~/lib/extractPathWithoutFragment';
import CarbonAds from './CarbonsAds';
import { useTheme } from 'next-themes';
import ExternalLinkIcon from '../public/icons/external-link-black.svg';

const DocLink = ({
uri,
Expand Down Expand Up @@ -64,7 +65,7 @@ const DocLinkBlank = ({
return (
<Link
href={uri}
className={classnames('text-sm block py-1 pl-2', {
className={classnames('flex text-sm block py-1 pl-2', {
'font-medium': !isActive,
'text-primary text-bold border-l-2 border-l-primary font-semibold':
isActive,
Expand All @@ -75,12 +76,18 @@ const DocLinkBlank = ({
if (onClick) onClick();
setOpen(false);
}}
style={{
position: 'relative',
paddingRight: '1.25em',
}}
>
{label}
<ExternalLinkIcon
style={{ marginLeft: '0.25em', width: '1em', height: '1em' }}
/>
</Link>
);
};

const SegmentSubtitle = ({ label }: { label: string }) => {
return (
<div className='text-sm italic text-slate-900 dark:text-slate-400 mt-2 mb-2'>
Expand Down
8 changes: 8 additions & 0 deletions public/icons/external-link-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 014026c

Please sign in to comment.