mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-12-07 04:53:50 +01:00
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/**
|
|
* 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 {useCollapsible, Collapsible} from '@docusaurus/theme-common';
|
|
import TOCItems from '@theme/TOCItems';
|
|
import CollapseButton from '@theme/TOCCollapsible/CollapseButton';
|
|
import styles from './styles.module.css';
|
|
export default function TOCCollapsible({
|
|
toc,
|
|
className,
|
|
minHeadingLevel,
|
|
maxHeadingLevel,
|
|
}) {
|
|
const {collapsed, toggleCollapsed} = useCollapsible({
|
|
initialState: true,
|
|
});
|
|
return (
|
|
<div
|
|
className={clsx(
|
|
styles.tocCollapsible,
|
|
!collapsed && styles.tocCollapsibleExpanded,
|
|
className,
|
|
)}>
|
|
<CollapseButton collapsed={collapsed} onClick={toggleCollapsed} />
|
|
<Collapsible
|
|
lazy
|
|
className={styles.tocCollapsibleContent}
|
|
collapsed={collapsed}>
|
|
<TOCItems
|
|
toc={toc}
|
|
minHeadingLevel={minHeadingLevel}
|
|
maxHeadingLevel={maxHeadingLevel}
|
|
/>
|
|
</Collapsible>
|
|
</div>
|
|
);
|
|
}
|