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:
22
components/HeadingAnchor/HeadingAnchor.tsx
Normal file
22
components/HeadingAnchor/HeadingAnchor.tsx
Normal 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;
|
Reference in New Issue
Block a user