Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 2e6b28d

Browse files
authored
Merge pull request #96 from hubert-deriv/introduction_page_header_green
Hubert / swizzling and adjusting tableofcontents
2 parents f9b9016 + 368700f commit 2e6b28d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/theme/TOC/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* eslint-disable */
2+
import React from 'react';
3+
import clsx from 'clsx';
4+
import TOCItems from '@theme/TOCItems';
5+
import styles from './styles.module.css';
6+
// Using a custom className
7+
// This prevents TOCInline/TOCCollapsible getting highlighted by mistake
8+
const LINK_CLASS_NAME = 'table-of-contents__link toc-highlight';
9+
const LINK_ACTIVE_CLASS_NAME = 'table-of-contents__link--active';
10+
export default function TOC({ className, ...props }) {
11+
return (
12+
<div className={clsx(styles.tableOfContents, 'thin-scrollbar', className)}>
13+
<TOCItems
14+
{...props}
15+
linkClassName={LINK_CLASS_NAME}
16+
linkActiveClassName={LINK_ACTIVE_CLASS_NAME}
17+
/>
18+
</div>
19+
);
20+
}

src/theme/TOC/styles.module.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.tableOfContents {
2+
max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
3+
overflow-y: auto;
4+
position: sticky;
5+
top: calc(var(--ifm-navbar-height) + 1rem);
6+
}
7+
8+
.tableOfContents li a {
9+
color: var(--ifm-toc-link-color);
10+
}
11+
12+
.tableOfContents li a:hover {
13+
color: unset;
14+
}
15+
16+
@media (max-width: 996px) {
17+
.tableOfContents {
18+
display: none;
19+
}
20+
21+
.docItemContainer {
22+
padding: 0 0.3rem;
23+
}
24+
}

0 commit comments

Comments
 (0)