import classNames from "classnames"; import type { HTMLAttributes } from "react"; import styles from "./Heading.module.css"; type Props = HTMLAttributes & { as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; }; const Heading = ({ as: Component, id, className, children, ...rest }: Props) => { return ( {children} {/* add anchor link to H2s and H3s. ID is already generated by rehype-slug. `#` character inserted via CSS. */} {id && (Component === "h2" || Component === "h3") && ( )} ); }; export const H1 = (props: Omit) => ; export const H2 = (props: Omit) => ; export const H3 = (props: Omit) => ; export const H4 = (props: Omit) => ; export const H5 = (props: Omit) => ; export const H6 = (props: Omit) => ; export default Heading;