diff options
Diffstat (limited to 'src/components/organisms/widgets/table-of-contents.tsx')
| -rw-r--r-- | src/components/organisms/widgets/table-of-contents.tsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/components/organisms/widgets/table-of-contents.tsx b/src/components/organisms/widgets/table-of-contents.tsx index 8892485..5f14415 100644 --- a/src/components/organisms/widgets/table-of-contents.tsx +++ b/src/components/organisms/widgets/table-of-contents.tsx @@ -1,9 +1,9 @@ import type { FC } from 'react'; import { useIntl } from 'react-intl'; import { useHeadingsTree, type Heading } from '../../../utils/hooks'; -import { type LinksListItems, LinksListWidget } from './links-list-widget'; +import { Heading as HeadingComponent } from '../../atoms'; +import { LinksWidget, type LinksWidgetItemData } from './links-widget'; import styles from './table-of-contents.module.scss'; -import { Heading as HeadingComponent } from 'src/components/atoms'; type TableOfContentsProps = { /** @@ -32,17 +32,18 @@ export const TableOfContents: FC<TableOfContentsProps> = ({ wrapper }) => { * @param {Heading[]} tree - The headings tree. * @returns {LinksListItems[]} The list items. */ - const getItems = (tree: Heading[]): LinksListItems[] => + const getItems = (tree: Heading[]): LinksWidgetItemData[] => tree.map((heading) => { return { - name: heading.title, + id: heading.id, + label: heading.title, url: `#${heading.id}`, child: getItems(heading.children), }; }); return ( - <LinksListWidget + <LinksWidget className={styles.list} heading={ <HeadingComponent isFake level={3}> |
