mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
fix(v2): right toc should be sticky
This commit is contained in:
parent
38af934464
commit
1e79a4b5ee
2 changed files with 14 additions and 2 deletions
|
@ -8,7 +8,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import Head from '@docusaurus/Head';
|
||||
|
||||
import DocPaginator from '@theme/DocPaginator';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
|
@ -53,7 +52,11 @@ function DocItem(props) {
|
|||
<DocPaginator docsMetadata={docsMetadata} metadata={metadata} />
|
||||
</div>
|
||||
<div className="col col--3 col--offset-1">
|
||||
{DocContent.rightToc && <Headings headings={DocContent.rightToc} />}
|
||||
{DocContent.rightToc && (
|
||||
<div className={styles.tableOfContents}>
|
||||
<Headings headings={DocContent.rightToc} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,3 +8,12 @@
|
|||
.docBody {
|
||||
min-height: calc(100vh - 50px);
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 996px) {
|
||||
.tableOfContents {
|
||||
max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
|
||||
overflow-y: auto;
|
||||
position: sticky;
|
||||
top: calc(var(--ifm-navbar-height) + 2rem);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue