Made external link icon optional
This commit is contained in:
parent
0fc2737a00
commit
ce420c3205
3 changed files with 6 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ export function NavLinks() {
|
||||||
<ExternalLink
|
<ExternalLink
|
||||||
href={item.href}
|
href={item.href}
|
||||||
className="flex items-center gap-2 px-2 py-1 hover:no-underline focus:no-underline"
|
className="flex items-center gap-2 px-2 py-1 hover:no-underline focus:no-underline"
|
||||||
|
skipIcon
|
||||||
>
|
>
|
||||||
{item.icon}
|
{item.icon}
|
||||||
{item.label}
|
{item.label}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export async function Sidebar() {
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-auto flex gap-4 mx-auto">
|
<div className="mt-auto flex gap-4 mx-auto">
|
||||||
{socialLinks.map(({ icon, url }) => (
|
{socialLinks.map(({ icon, url }) => (
|
||||||
<ExternalLink key={url} href={url}>
|
<ExternalLink key={url} href={url} skipIcon>
|
||||||
<svg
|
<svg
|
||||||
dangerouslySetInnerHTML={{ __html: icon.svg }}
|
dangerouslySetInnerHTML={{ __html: icon.svg }}
|
||||||
className="inline-block w-6 h-6 mr-1 fill-fg-dim hover:fill-accent transition-colors"
|
className="inline-block w-6 h-6 mr-1 fill-fg-dim hover:fill-accent transition-colors"
|
||||||
|
|
@ -62,6 +62,7 @@ export async function Sidebar() {
|
||||||
<ExternalLink
|
<ExternalLink
|
||||||
href={gitOriginUrl + '/commit/' + gitCommitHash}
|
href={gitOriginUrl + '/commit/' + gitCommitHash}
|
||||||
className="hover:underline"
|
className="hover:underline"
|
||||||
|
skipIcon
|
||||||
>
|
>
|
||||||
{gitCommitHash.slice(0, 7)}
|
{gitCommitHash.slice(0, 7)}
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,14 @@ type ExternalLinkProps = Omit<
|
||||||
'href' | 'rel' | 'target'
|
'href' | 'rel' | 'target'
|
||||||
> & {
|
> & {
|
||||||
href: string
|
href: string
|
||||||
|
skipIcon?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ExternalLink({ children, ...props }: ExternalLinkProps) {
|
export function ExternalLink({ children, skipIcon, ...props }: ExternalLinkProps) {
|
||||||
return (
|
return (
|
||||||
<a {...props} target="_blank" rel="noopener noreferrer">
|
<a {...props} target="_blank" rel="noopener noreferrer">
|
||||||
{children}
|
{children}
|
||||||
<ExternalLinkIcon className="inline-block w-3 h-3 ml-1 mb-2" />
|
{!skipIcon && <ExternalLinkIcon className="inline-block w-3 h-3 ml-1 mb-2" />}
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue