1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

reduced TOC, fix scrollspy

This commit is contained in:
Matthias Kretschmann 2019-03-27 16:31:43 +01:00
parent 253cb14085
commit f4fd41ef38
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -1,10 +1,10 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import slugify from 'slugify'
// import Scrollspy from 'react-scrollspy'
import Scrollspy from 'react-scrollspy'
import Scroll from '../../components/Scroll'
import { cleanPaths } from './utils'
// import stylesSidebar from '../../components/Sidebar.module.scss'
import stylesSidebar from '../../components/Sidebar.module.scss'
export default class Toc extends PureComponent {
static propTypes = {
@ -36,24 +36,27 @@ export default class Toc extends PureComponent {
const slug = slugify(cleanedPath, {
remove: /[*+~.()'"/!:@]/g
})
let entity = cleanedPath.split('/')
entity = entity.pop()
return (
<li key={path}>
<Scroll type="id" element={slug} offset={-20}>
<code>{cleanedPath}</code>
<Scroll type="id" element={`${slug}`} offset={-20}>
<code>{entity}</code>
</Scroll>
{/* <Scrollspy
items={this.state.subIds}
currentClassName={stylesSidebar.scrollspyActive}
offset={-30}
>
{cleanedPath}
</Scrollspy> */}
</li>
)
})
render() {
return <ul>{this.items}</ul>
return (
<Scrollspy
items={this.state.subIds}
currentClassName={stylesSidebar.scrollspyActive}
offset={-30}
>
{this.items}
</Scrollspy>
)
}
}