mirror of
https://github.com/benjaminion/upgrading-ethereum-book.git
synced 2026-01-08 06:03:53 -05:00
28 lines
746 B
Plaintext
28 lines
746 B
Plaintext
---
|
|
import PageList from './PageList.astro';
|
|
import '../css/subsections.css';
|
|
|
|
const { indexArray, pages } = Astro.props;
|
|
|
|
let index = indexArray;
|
|
|
|
// Only add the auto index for Parts, not any deeper structure
|
|
if (index === undefined || index === null || index.length > 1) return null;
|
|
|
|
// Special hacky handling for the the /contents page
|
|
if (index[0] === -1) {
|
|
index = [];
|
|
}
|
|
|
|
// Find pages that are subsections of the page we are on
|
|
const indexFilterString = index.length === 0 ? '' : index.join() + ',';
|
|
const filteredPages = pages.filter(p => p.data.index.join().startsWith(indexFilterString))
|
|
---
|
|
|
|
{filteredPages.length > 0
|
|
? <div class="subsection-list">
|
|
<PageList pages={filteredPages} depth={index.length} />
|
|
</div>
|
|
: null
|
|
}
|