Skip to content

Commit

Permalink
feat(docz): add support for custom not found route
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jun 9, 2018
1 parent 2ea2f82 commit 455dcca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/docz/src/components/DocPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type PageProps = RouteComponentProps<any> & {
export interface ComponentsMap {
loading?: React.ComponentType
page?: React.ComponentType<PageProps>
notFound?: React.ComponentType<RouteComponentProps<any>>
render?: RenderComponent
h1?: React.ComponentType<any>
h2?: React.ComponentType<any>
Expand Down Expand Up @@ -41,6 +42,7 @@ export interface DocPreviewProps {

export const DocPreview: SFC<DocPreviewProps> = ({ components = {} }) => {
const Page = components.page
const NotFound = components.notFound
const LoadingComponent = components.loading || DefaultLoading

return (
Expand Down Expand Up @@ -73,6 +75,7 @@ export const DocPreview: SFC<DocPreviewProps> = ({ components = {} }) => {
)
)
})}
{NotFound && <Route component={NotFound} />}
</Switch>
)}
</dataContext.Consumer>
Expand Down

0 comments on commit 455dcca

Please sign in to comment.