Add custom anchor component

This commit is contained in:
Defectink
2022-03-28 13:07:32 +08:00
parent fac934eee2
commit 2d9e2c3c8c
2 changed files with 35 additions and 1 deletions

26
components/mdx/Anchor.tsx Normal file
View File

@ -0,0 +1,26 @@
import { AnchorHTMLAttributes } from 'react';
import cn from 'classnames';
import { FiExternalLink } from 'react-icons/fi';
interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {}
const Anchor = ({ children, ...rest }: Props) => {
return (
<>
<a
{...rest}
className={cn(
'mx-[2px] text-teal-500 relative',
'before:left-0 before:top-[1px] before:block before:absolute',
'before:w-full before:h-full before:transition-all before:shadow-underline',
'hover:before:shadow-throughline',
'dark:text-teal-600'
)}
>
{children}
</a>
</>
);
};
export default Anchor;