1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 01:01:17 -04:00

fix super nitpicky indented headings

This commit is contained in:
2022-03-12 11:07:33 -05:00
parent 50071eef58
commit ddb9fdff8d
5 changed files with 29 additions and 13 deletions

View File

@@ -0,0 +1,22 @@
import { styled } from "../../lib/styles/stitches.config";
import type { ComponentProps } from "react";
const PoundSignLink = styled("a", {
textDecoration: "none",
"&::before": {
// pound sign `#`, done here to keep content DOM cleaner
content: "\\0023",
},
});
export type HeadingAnchorProps = ComponentProps<typeof PoundSignLink> & {
id: string;
title: string;
};
const HeadingAnchor = ({ id, title, ...rest }: HeadingAnchorProps) => (
<PoundSignLink href={`#${id}`} title={`Jump to "${title}"`} tabIndex={-1} aria-hidden={true} {...rest} />
);
export default HeadingAnchor;