wip(fs.dev): More work on new dev site
This commit is contained in:
parent
d4baf722f3
commit
096c2f5f6a
10 changed files with 55 additions and 21 deletions
|
@ -10,7 +10,7 @@ import rendertest from '@freesewing/rendertest'
|
|||
import tutorial from '@freesewing/tutorial'
|
||||
|
||||
|
||||
const mdxCustomComponents = {
|
||||
const mdxCustomComponents = (app) => ({
|
||||
// Custom components
|
||||
DesignIterator,
|
||||
Example: props => <Example
|
||||
|
@ -20,7 +20,7 @@ const mdxCustomComponents = {
|
|||
Fixme: props => <Popout {...props} fixme />,
|
||||
Link: props => <Popout {...props} link />,
|
||||
Note: props => <Popout {...props} note />,
|
||||
ReadMore,
|
||||
ReadMore: props => <ReadMore {...props} app={app} />,
|
||||
Related: props => <Popout {...props} related />,
|
||||
Tip: props => <Popout {...props} tip />,
|
||||
Warning: props => <Popout {...props} warning />,
|
||||
|
@ -39,7 +39,7 @@ const mdxCustomComponents = {
|
|||
</Popout>
|
||||
),
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
export default mdxCustomComponents
|
||||
|
||||
|
|
|
@ -1,4 +1,24 @@
|
|||
const ReadMore = props => <p>FIXME: Example still todo</p>
|
||||
import get from 'lodash.get'
|
||||
import orderBy from 'lodash.orderby'
|
||||
import Link from 'next/link'
|
||||
|
||||
// Helper method to filter out the real children
|
||||
const currentChildren = current => Object.values(current)
|
||||
.filter(entry => (typeof entry === 'object'))
|
||||
|
||||
const ReadMore = props => {
|
||||
|
||||
const root = get(props.app.navigation, props.app.slug.split('/'))
|
||||
const list = []
|
||||
for (const page of currentChildren(root)) {
|
||||
list.push(<li key={page.__slug}>
|
||||
<Link href={`/${page.__slug}`}>
|
||||
<a>{page.__title}</a>
|
||||
</Link>
|
||||
</li>)
|
||||
}
|
||||
return <ul>{list}</ul>
|
||||
}
|
||||
|
||||
export default ReadMore
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue