From 6c90d3767235bf76417dd39c9a8e1e9ce30dfda7 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 28 Jan 2019 11:59:40 +0100 Subject: [PATCH] scrollspy for sub items --- src/templates/Typedoc/Entities.jsx | 22 +++++------ src/templates/Typedoc/Toc.jsx | 59 ++++++++++++------------------ 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/src/templates/Typedoc/Entities.jsx b/src/templates/Typedoc/Entities.jsx index 11dbd5a7..451dc206 100644 --- a/src/templates/Typedoc/Entities.jsx +++ b/src/templates/Typedoc/Entities.jsx @@ -173,9 +173,7 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
Deprecated: use{' '} - - {deprecatedUse} - + {deprecatedUse} {' '} instead
@@ -224,16 +222,14 @@ const Entities = ({ entities, sourceUrl }) => )} - {children - .filter(filterByKindOfProperty) - .map(property => ( - - ))} + {children.filter(filterByKindOfProperty).map(property => ( + + ))} )) diff --git a/src/templates/Typedoc/Toc.jsx b/src/templates/Typedoc/Toc.jsx index fdd2c47a..43f0d25f 100644 --- a/src/templates/Typedoc/Toc.jsx +++ b/src/templates/Typedoc/Toc.jsx @@ -6,55 +6,44 @@ import stylesSidebar from '../../components/Sidebar.module.scss' const Toc = ({ data }) => { const subItems = (children, parentName) => - children.map(({ name }) => { - return ( -
  • - - {name} - -
  • - ) - }) + children.map(({ name }) => ( +
  • + + {name} + +
  • + )) const items = data.map(({ name, children }) => { - // let subIds = [] + let subIds = [] + const parentName = name - // subIds.push( - // data.map(({ name, children }) => { - // const parentName = name - // let childId - - // children.map(({ name }) => { - // childId = `${parentName}-${slugify(name)}` - // }) - - // return childId - // }) - // ) - - // console.log(subIds) + subIds.push( + children.map(({ name }) => { + return `${parentName}-${slugify(name)}` + }) + ) return (
  • {name} -
      {subItems(children, name)}
    + + {subItems(children, name)} +
  • ) }) - let Ids = [] - Ids.push(data.map(({ name }) => slugify(name))) + // let Ids = [] + // Ids.push(data.map(({ name }) => slugify(name))) - return ( - - {items} - - ) + return
      {items}
    } Toc.propTypes = {