import React from 'react' import { Link } from '@/frame/components/Link' import type { TocItem } from '@/landings/types' type Props = { items: Array variant?: 'compact' | 'expanded' } export const TableOfContents = (props: Props) => { const { items, variant = 'expanded' } = props return (
{variant === 'expanded' && items.map((item) => { const { fullPath: href, title, intro } = item return (

{title}

{intro && (
)}
) })} {variant === 'compact' && (
    {items.map((item) => { const { fullPath, title, childTocItems } = item return (
  • {title} {(childTocItems || []).filter(Boolean).length > 0 && (
      {(childTocItems || []).filter(Boolean).map((childItem) => (
    • {childItem.title}
    • ))}
    )}
  • ) })}
)}
) }