|
1 | 1 | import { useRouter } from 'next/router' |
2 | 2 | import cx from 'classnames' |
3 | | -import { Heading } from '@primer/components' |
| 3 | +import { ActionList, Heading } from '@primer/components' |
4 | 4 |
|
5 | 5 | import { ZapIcon, InfoIcon, ShieldLockIcon } from '@primer/octicons-react' |
6 | 6 | import { Callout } from 'components/ui/Callout' |
@@ -45,12 +45,19 @@ export const ArticlePage = () => { |
45 | 45 |
|
46 | 46 | const renderTocItem = (item: MiniTocItem) => { |
47 | 47 | return ( |
48 | | - <li key={item.contents} className={cx(item.platform, 'mb-2 lh-condensed')}> |
49 | | - <div className="mb-2 lh-condensed" dangerouslySetInnerHTML={{ __html: item.contents }} /> |
50 | | - {item.items && item.items.length > 0 ? ( |
51 | | - <ul className="list-style-none pl-0 f5 mb-0 ml-3">{item.items.map(renderTocItem)}</ul> |
52 | | - ) : null} |
53 | | - </li> |
| 48 | + <ActionList.Item |
| 49 | + as="div" |
| 50 | + key={item.contents} |
| 51 | + className={item.platform} |
| 52 | + sx={{ listStyle: 'none', padding: '2px' }} |
| 53 | + > |
| 54 | + <div className={cx('lh-condensed')}> |
| 55 | + <div dangerouslySetInnerHTML={{ __html: item.contents }} /> |
| 56 | + {item.items && item.items.length > 0 ? ( |
| 57 | + <ul className="ml-3">{item.items.map(renderTocItem)}</ul> |
| 58 | + ) : null} |
| 59 | + </div> |
| 60 | + </ActionList.Item> |
54 | 61 | ) |
55 | 62 | } |
56 | 63 |
|
@@ -111,13 +118,19 @@ export const ArticlePage = () => { |
111 | 118 | {miniTocItems.length > 1 && ( |
112 | 119 | <> |
113 | 120 | <Heading as="h2" fontSize={1} id="in-this-article" className="mb-1"> |
114 | | - <a className="Link--primary" href="#in-this-article"> |
115 | | - {t('miniToc')} |
116 | | - </a> |
| 121 | + <Link href="#in-this-article">{t('miniToc')}</Link> |
117 | 122 | </Heading> |
118 | | - <ul className="list-style-none pl-0 f5 mb-0"> |
119 | | - {miniTocItems.map(renderTocItem)} |
120 | | - </ul> |
| 123 | + |
| 124 | + <ActionList |
| 125 | + key={title} |
| 126 | + items={miniTocItems.map((items) => { |
| 127 | + return { |
| 128 | + key: title, |
| 129 | + text: title, |
| 130 | + renderItem: () => <ul>{renderTocItem(items)}</ul>, |
| 131 | + } |
| 132 | + })} |
| 133 | + /> |
121 | 134 | </> |
122 | 135 | )} |
123 | 136 | </> |
|
0 commit comments