mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 01:47:17 +02:00
* chore: clean up ESLint config, enable a few rules * enable max-len for comments * fix build
31 lines
928 B
TypeScript
31 lines
928 B
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import React from 'react';
|
|
import clsx from 'clsx';
|
|
import type {TOCProps} from '@theme/TOC';
|
|
import TOCItems from '@theme/TOCItems';
|
|
import styles from './styles.module.css';
|
|
|
|
// Using a custom className
|
|
// This prevents TOCInline/TOCCollapsible getting highlighted by mistake
|
|
const LINK_CLASS_NAME = 'table-of-contents__link toc-highlight';
|
|
const LINK_ACTIVE_CLASS_NAME = 'table-of-contents__link--active';
|
|
|
|
function TOC({className, ...props}: TOCProps): JSX.Element {
|
|
return (
|
|
<div className={clsx(styles.tableOfContents, 'thin-scrollbar', className)}>
|
|
<TOCItems
|
|
{...props}
|
|
linkClassName={LINK_CLASS_NAME}
|
|
linkActiveClassName={LINK_ACTIVE_CLASS_NAME}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default TOC;
|