docs: split and expand backend docs (#3350)

This commit is contained in:
Shawn Erquhart
2020-03-02 12:34:33 -05:00
committed by GitHub
parent 4e1e5a9bd5
commit 567adc7e11
11 changed files with 287 additions and 236 deletions

View File

@ -33,6 +33,7 @@ const TableOfContents = () => {
const [headings, setHeadings] = useState([]);
useEffect(() => {
// TODO: we should be generating headings during the build
const contentHeadings = document.querySelectorAll('[data-docs-content] h2');
const headings = [];
contentHeadings.forEach(h => {
@ -46,13 +47,15 @@ const TableOfContents = () => {
}, []);
return (
<TocList>
{headings.map(h => (
<li key={h.id}>
<TocLink href={`#${h.id}`}>{h.text}</TocLink>
</li>
))}
</TocList>
headings.length > 0 && (
<TocList>
{headings.map(h => (
<li key={h.id}>
<TocLink href={`#${h.id}`}>{h.text}</TocLink>
</li>
))}
</TocList>
)
);
};