1- import cx from 'classnames'
21import React from 'react'
32
43import { Link } from '@/frame/components/Link'
54import type { TocItem } from '@/landings/types'
6- import { ActionList } from '@primer/react'
7- import styles from './TableOfContents.module.css'
85
96type Props = {
107 items : Array < TocItem >
@@ -14,10 +11,7 @@ export const TableOfContents = (props: Props) => {
1411 const { items, variant = 'expanded' } = props
1512
1613 return (
17- < div
18- data-testid = "table-of-contents"
19- className = { cx ( variant === 'compact' ? 'list-style-outside pl-2' : '' ) }
20- >
14+ < div data-testid = "table-of-contents" >
2115 { variant === 'expanded' &&
2216 items . map ( ( item ) => {
2317 const { fullPath : href , title, intro } = item
@@ -41,40 +35,29 @@ export const TableOfContents = (props: Props) => {
4135 } ) }
4236
4337 { variant === 'compact' && (
44- < ActionList >
38+ < ul className = "list-style-none f4" >
4539 { items . map ( ( item ) => {
4640 const { fullPath, title, childTocItems } = item
4741 return (
48- < React . Fragment key = { fullPath } >
49- < ActionList . LinkItem href = { fullPath } as = "a" className = { styles . linkItem } >
42+ < li key = { fullPath } className = "mb-2" >
43+ < Link href = { fullPath } className = "text-underline mb-2 d-block" >
5044 { title }
51- </ ActionList . LinkItem >
52- { ( childTocItems || [ ] ) . length > 0 && (
53- < li className = "f4 color-fg-accent d-list-item d-block width-full text-underline" >
54- < ActionList
55- className = { cx (
56- variant === 'compact' ? 'list-style-circle pl-5' : 'list-style-none' ,
57- ) }
58- >
59- { ( childTocItems || [ ] ) . filter ( Boolean ) . map ( ( childItem ) => {
60- return (
61- < ActionList . LinkItem
62- key = { childItem . fullPath }
63- href = { childItem . fullPath }
64- as = "a"
65- className = { styles . linkItem }
66- >
67- { childItem . title }
68- </ ActionList . LinkItem >
69- )
70- } ) }
71- </ ActionList >
72- </ li >
45+ </ Link >
46+ { ( childTocItems || [ ] ) . filter ( Boolean ) . length > 0 && (
47+ < ul className = "pl-4 list-style-none" >
48+ { ( childTocItems || [ ] ) . filter ( Boolean ) . map ( ( childItem ) => (
49+ < li key = { childItem . fullPath } className = "mb-2" >
50+ < Link href = { childItem . fullPath } className = "text-underline" >
51+ { childItem . title }
52+ </ Link >
53+ </ li >
54+ ) ) }
55+ </ ul >
7356 ) }
74- </ React . Fragment >
57+ </ li >
7558 )
7659 } ) }
77- </ ActionList >
60+ </ ul >
7861 ) }
7962 </ div >
8063 )
0 commit comments