docs: fix potential null errors (#2324)

This commit is contained in:
Marvin Hagemeister
2024-02-20 01:19:08 +01:00
committed by GitHub
parent f1c17bc67e
commit 46eaef0181
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -17,6 +17,8 @@ function setActiveLink(
`a[href="#${id}"]`,
) as HTMLElement;
if (tocLink === null) return;
tocLink.classList.add("active");
const rect = tocLink
@@ -62,8 +64,10 @@ export function TableOfContents({ headings }: TableOfContentsProps) {
const id = headings[i].id;
const tocLink = container.querySelector(
`a[href="#${id}"]`,
) as HTMLElement;
tocLink.classList.remove("active");
);
if (tocLink !== null) {
tocLink.classList.remove("active");
}
}
let activeIdx = visibleList.indexOf(true);
+1 -1
View File
@@ -197,7 +197,7 @@ export default function DocsPage(props: PageProps<Data>) {
<div class="flex gap-6 md:gap-8 xl:gap-[8%] flex-col xl:flex-row md:mx-8 lg:mx-16 2xl:mx-0 lg:justify-end">
<TableOfContents headings={headings} />
<div class="lg:order-1 min-w-0 max-w-3xl">
<div class="lg:order-1 min-w-0 max-w-3xl w-full">
<h1 class="text-4xl text-gray-900 tracking-tight font-bold md:mt-0 px-4 md:px-0 mb-4">
{page.title}
</h1>