diff --git a/components/article/ArticlePage.tsx b/components/article/ArticlePage.tsx index c1ac03e446..4b34b81442 100644 --- a/components/article/ArticlePage.tsx +++ b/components/article/ArticlePage.tsx @@ -1,9 +1,8 @@ import { useRouter } from 'next/router' -import { useState } from 'react' import cx from 'classnames' import { ActionList, Heading } from '@primer/components' -import { ChevronDownIcon, ZapIcon, InfoIcon, ShieldLockIcon } from '@primer/octicons-react' +import { ZapIcon, InfoIcon, ShieldLockIcon } from '@primer/octicons-react' import { Callout } from 'components/ui/Callout' import { Link } from 'components/Link' @@ -61,9 +60,8 @@ export const ArticlePage = () => { } = useArticleContext() const { t } = useTranslation('pages') const currentPath = router.asPath.split('?')[0] - const [isActive, setActive] = useState(-1) - const renderTocItem = (item: MiniTocItem, index: number) => { + const renderTocItem = (item: MiniTocItem) => { return ( { sx={{ listStyle: 'none', padding: '2px' }} >
-
- {item.items && item.items.length > 0 && ( - - )} +
{item.items && item.items.length > 0 ? ( -
    - {item.items.map(renderTocItem)} -
+
    {item.items.map(renderTocItem)}
) : null}
@@ -158,7 +146,7 @@ export const ArticlePage = () => { return { key: title + i, text: title, - renderItem: () =>
    {renderTocItem(items, i)}
, + renderItem: () =>
    {renderTocItem(items)}
, } })} /> diff --git a/tests/rendering/server.js b/tests/rendering/server.js index b216a77695..90cb392787 100644 --- a/tests/rendering/server.js +++ b/tests/rendering/server.js @@ -344,7 +344,7 @@ describe('server', () => { ) expect($('h2#in-this-article').length).toBe(1) expect($('h2#in-this-article + div div ul').length).toBeGreaterThan(0) // non-indented items - expect($('h2#in-this-article + div div ul li div div div ul li').length).toBeGreaterThan(0) // indented items + expect($('h2#in-this-article + div div ul li div div div ul.ml-3').length).toBeGreaterThan(0) // indented items }) test('does not render mini TOC in articles with only one heading', async () => {