-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docz): add custom routes for docs
- Loading branch information
1 parent
9ebe65d
commit 8458d91
Showing
6 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react' | ||
import { doc } from 'playgrodd' | ||
|
||
doc('Home') | ||
.route('/') | ||
.order(1) | ||
.section(() => <div>This is home</div>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import * as React from 'react' | ||
import { SFC } from 'react' | ||
import { Subscribe } from 'unstated' | ||
import { DocsProps } from 'playgrodd' | ||
import { Doc, DocsProps } from 'playgrodd' | ||
|
||
import { DocsContainer } from '../container' | ||
|
||
const sortByOrder = (a: Doc, b: Doc) => b.docOrder - a.docOrder | ||
|
||
export const Docs: SFC<DocsProps> = ({ children }) => ( | ||
<Subscribe to={[DocsContainer]}> | ||
{({ state }) => children(Object.values(state.docs))} | ||
{({ state }) => { | ||
const docsArr: Doc[] = Object.values(state.docs) | ||
return children(docsArr.sort(sortByOrder)) | ||
}} | ||
</Subscribe> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters