import innerText from "react-innertext"; import clsx from "clsx"; import HeadingAnchor from "../HeadingAnchor"; import type { JSX, ComponentPropsWithoutRef } from "react"; import styles from "./Heading.module.css"; export type HeadingProps = ComponentPropsWithoutRef<"h1"> & { level: 1 | 2 | 3 | 4 | 5 | 6; divider?: boolean; }; const Heading = ({ level, id, divider, className, children, ...rest }: HeadingProps) => { const HWild: keyof JSX.IntrinsicElements = `h${level}`; return ( {children} {/* add anchor link to H2s and H3s. ID is either provided or automatically generated by rehype-slug. */} {id && (level === 2 || level === 3) && ( )} ); }; 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;