Skip to content

Commit

Permalink
fix(docz): default DocPreview components
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jul 19, 2018
1 parent f0bd532 commit ff7cf32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/docz/src/components/DocPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export type PageProps = RouteComponentProps<any> & {
doc: Entry
}

const Identity: SFC<any> = ({ children }) => children
const DefaultLoading: SFC = () => null
const Identity: SFC<any> = ({ children }) => <Fragment>{children}</Fragment>
const DefaultLoading: SFC = () => <Fragment>Loading</Fragment>

export type RenderComponent = ComponentType<{
component: JSX.Element
Expand All @@ -27,6 +27,9 @@ export const DefaultRender: RenderComponent = ({ component, code }) => (
</Fragment>
)

export type NotFoundComponent = ComponentType<RouteComponentProps<any>>
const DefaultNotFound: NotFoundComponent = () => <Fragment>Not found</Fragment>

export interface ComponentsMap {
loading?: ComponentType
page?: ComponentType<PageProps>
Expand Down Expand Up @@ -58,8 +61,8 @@ const loadImport = (imports: ImportMap, components: ComponentsMap) => (
const defaultComponents: ComponentsMap = {
loading: DefaultLoading,
render: DefaultRender,
notFound: DefaultNotFound,
page: Identity,
notFound: Identity,
}

export interface DocPreviewProps {
Expand Down

0 comments on commit ff7cf32

Please sign in to comment.