Update table of contents

This commit is contained in:
Defectink
2022-04-01 15:15:38 +08:00
parent d68b4523ef
commit 11fcb9677f
7 changed files with 71 additions and 39 deletions

View File

@ -2,13 +2,16 @@ import { AnchorHTMLAttributes } from 'react';
import cn from 'classnames';
import { FiExternalLink } from 'react-icons/fi';
interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {}
interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {
external?: boolean;
}
const Anchor = ({ children, ...rest }: Props) => {
const Anchor = ({ children, external = true, ...rest }: Props) => {
return (
<>
<a
{...rest}
target={external ? '_blank' : undefined}
className={cn(
'mx-[2px] text-teal-500 relative',
'before:left-0 before:top-[1px] before:block before:absolute',
@ -18,6 +21,7 @@ const Anchor = ({ children, ...rest }: Props) => {
)}
>
{children}
{external && <FiExternalLink className="inline ml-1 mb-[0.2rem]" />}
</a>
</>
);