Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/TableOfContents/TableOfContentsMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Mobile = ({ items, maxDepth, variant }: TableOfContentsMobileProps) => {
<DropdownMenuContent
align="start"
sideOffset={8}
className="w-[var(--radix-dropdown-menu-trigger-width)]"
className="max-h-[calc(100vh-20rem)] w-[var(--radix-dropdown-menu-trigger-width)] overflow-y-auto"
// prevents focus from moving to the trigger after closing
onCloseAutoFocus={(e) => {
e.preventDefault()
Expand Down
11 changes: 9 additions & 2 deletions src/components/TableOfContents/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const variants = cva(
{
variants: {
variant: {
docs: "top-19 min-w-48 max-w-[25%] p-4 pe-0 gap-4",
docs: "top-19 min-w-48 max-w-[25%] p-4 pb-16 pe-0 gap-4 max-h-[calc(100vh-5rem)]",
card: cn(
"top-28 min-w-80 max-w-72 lg:p-8 px-3 py-2",
"shrink-0 gap-y-2.5 rounded-2xl bg-accent-a/10 text-body-medium"
Expand Down Expand Up @@ -112,8 +112,15 @@ const TableOfContents = ({
return <Mobile variant={variant} items={items} maxDepth={maxDepth} />
}

// If "docs" (default) variant, apply 1rem fade to top for overflow scroll indication
const isDocsVariant = [undefined, null, "docs"].includes(variant)
const fadeMask = {
mask: `linear-gradient(to bottom, transparent 0, white 1rem)`,
}
const style = isDocsVariant ? { style: fadeMask } : {}

return (
<nav className={variants({ variant, className })} {...rest}>
<nav className={variants({ variant, className })} {...style} {...rest}>
{!hideEditButton && editPath && (
<ButtonLink
href={editPath}
Expand Down