mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Improvement: Sidebar list
This commit is contained in:
parent
fef6cb9fbf
commit
7e98d8d2c2
@ -4,6 +4,7 @@ import HeaderSection from '../components/HeaderSection'
|
|||||||
import Content from '../components/Content'
|
import Content from '../components/Content'
|
||||||
import styles from '../templates/Doc.module.scss'
|
import styles from '../templates/Doc.module.scss'
|
||||||
import MarkdownTemplate from './MarkdownTemplate'
|
import MarkdownTemplate from './MarkdownTemplate'
|
||||||
|
import sidebarStyles from '../components/Sidebar.module.scss'
|
||||||
|
|
||||||
export default function MarkdownList({ pageContext }) {
|
export default function MarkdownList({ pageContext }) {
|
||||||
const subSections = {}
|
const subSections = {}
|
||||||
@ -35,19 +36,26 @@ export default function MarkdownList({ pageContext }) {
|
|||||||
<Content>
|
<Content>
|
||||||
<main className={styles.wrapper}>
|
<main className={styles.wrapper}>
|
||||||
<aside className={styles.sidebar}>
|
<aside className={styles.sidebar}>
|
||||||
<ul>
|
<nav className={sidebarStyles.sidebar}>
|
||||||
{Object.keys(subSections).map((ele, subSectionIndex) => {
|
{Object.keys(subSections).map((ele, subSectionIndex) => {
|
||||||
return selectedSubSection === subSectionIndex ? (
|
return selectedSubSection === subSectionIndex ? (
|
||||||
<li key={subSectionIndex}>
|
<div key={subSectionIndex}>
|
||||||
|
<h4 className={sidebarStyles.groupTitle}>
|
||||||
<a
|
<a
|
||||||
style={{ cursor: 'pointer', color: 'black' }}
|
style={{ cursor: 'pointer', color: 'black' }}
|
||||||
onClick={() => changeSubsection(subSectionIndex)}
|
onClick={() => changeSubsection(subSectionIndex)}
|
||||||
>
|
>
|
||||||
{ele.replace(/_/g, ' ')}
|
{ele.replace(/_/g, ' ')}
|
||||||
</a>
|
</a>
|
||||||
|
<div className={sidebarStyles.list}>
|
||||||
<ul>
|
<ul>
|
||||||
{subSections[ele].map((node) => (
|
{subSections[ele].map((node) => (
|
||||||
<li
|
<li
|
||||||
|
className={
|
||||||
|
elem.id === node.id
|
||||||
|
? sidebarStyles.active
|
||||||
|
: sidebarStyles.link
|
||||||
|
}
|
||||||
key={node.id}
|
key={node.id}
|
||||||
onClick={() => changePage(subSectionIndex, node)}
|
onClick={() => changePage(subSectionIndex, node)}
|
||||||
>
|
>
|
||||||
@ -61,19 +69,23 @@ export default function MarkdownList({ pageContext }) {
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</div>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<li>
|
<div>
|
||||||
|
<h4 className={sidebarStyles.groupTitle}>
|
||||||
<a
|
<a
|
||||||
onClick={() => changeSubsection(subSectionIndex)}
|
onClick={() => changeSubsection(subSectionIndex)}
|
||||||
style={{ cursor: 'pointer', color: '#8b98a9' }}
|
style={{ cursor: 'pointer', color: '#8b98a9' }}
|
||||||
>
|
>
|
||||||
{ele.replace(/_/g, ' ')}
|
{ele.replace(/_/g, ' ')}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</h4>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
<article className={styles.main}>
|
<article className={styles.main}>
|
||||||
<MarkdownTemplate data={elem}></MarkdownTemplate>
|
<MarkdownTemplate data={elem}></MarkdownTemplate>
|
||||||
|
Loading…
Reference in New Issue
Block a user