mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
Update table of contents
This commit is contained in:
@ -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>
|
||||
</>
|
||||
);
|
||||
|
Reference in New Issue
Block a user