mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 07:05:21 -04:00
26 lines
576 B
TypeScript
26 lines
576 B
TypeScript
import Link from "../Link";
|
|
import { FiLink } from "react-icons/fi";
|
|
import type { ComponentPropsWithoutRef } from "react";
|
|
|
|
export type HeadingAnchorProps = Omit<ComponentPropsWithoutRef<typeof Link>, "href"> & {
|
|
id: string;
|
|
title: string;
|
|
};
|
|
|
|
const HeadingAnchor = ({ id, title, ...rest }: HeadingAnchorProps) => {
|
|
return (
|
|
<Link
|
|
href={`#${id}`}
|
|
title={`Jump to "${title}"`}
|
|
aria-hidden
|
|
underline={false}
|
|
style={{ lineHeight: 1 }}
|
|
{...rest}
|
|
>
|
|
<FiLink size="0.8em" />
|
|
</Link>
|
|
);
|
|
};
|
|
|
|
export default HeadingAnchor;
|