Skip to content

Commit

Permalink
Take className on ToC instead
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminleonard committed Dec 16, 2024
1 parent 23ec093 commit 17b0ec1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/src/asciidoc/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,11 @@ export function useActiveSectionTracking(
export const DesktopOutline = ({
toc,
activeItem,
className,
}: {
toc: DocumentSection[]
activeItem: string
className?: string
}) => {
const renderToc = (sections: DocumentSection[]) => {
return sections.map((item) => (
Expand Down Expand Up @@ -291,7 +293,7 @@ export const DesktopOutline = ({
}

if (toc && toc.length > 0) {
return <ul className="1200:block hidden">{renderToc(toc)}</ul>
return <ul className={className}>{renderToc(toc)}</ul>
}

return null
Expand All @@ -300,10 +302,12 @@ export const SmallScreenOutline = ({
toc,
activeItem,
title,
className,
}: {
toc: DocumentSection[]
activeItem: string
title: string
className?: string
}) => {
const renderToc = (sections: DocumentSection[]) => {
return sections.map((item) => (
Expand Down Expand Up @@ -336,7 +340,10 @@ export const SmallScreenOutline = ({
return (
<Accordion.Root
type="single"
className="sticky top-[calc(var(--header-height)-1px)] z-10 -mt-px mb-10 block max-h-[calc(100vh-var(--header-height)+1px)] w-full overflow-y-scroll border-b border-t bg-default border-secondary 1200:hidden print:hidden"
className={cn(
'sticky top-[calc(var(--header-height)-1px)] z-10 -mt-px mb-10 block max-h-2/3 w-full overflow-y-scroll border-b border-t bg-default border-secondary print:hidden',
className,
)}
collapsible
>
<Accordion.Item value={`small-toc-${title}`}>
Expand Down

0 comments on commit 17b0ec1

Please sign in to comment.