Skip to content

Commit

Permalink
fix: gatsby theme fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Mar 15, 2019
1 parent a4ced2b commit dcc5f19
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 22 deletions.
8 changes: 0 additions & 8 deletions core/docz-theme-default/src/components/ui/AsyncPlayground.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface PlaygroundProps extends BasePlaygroundProps {
showEditor?: boolean
}

const Playground: SFC<PlaygroundProps> = ({
export const Playground: SFC<PlaygroundProps> = ({
position,
code: initialCode,
codesandbox,
Expand Down Expand Up @@ -287,5 +287,3 @@ const Playground: SFC<PlaygroundProps> = ({
</LiveProvider>
)
}

export default Playground
4 changes: 2 additions & 2 deletions core/docz-theme-default/src/components/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncPlayground } from './AsyncPlayground'
import { Playground } from './Playground'
import { Blockquote } from './Blockquote'
import { H1 } from './H1'
import { H2 } from './H2'
Expand Down Expand Up @@ -35,7 +35,7 @@ export const components = {
ol: OrderedList,
p: Paragraph,
page: Page,
playground: AsyncPlayground,
playground: Playground,
pre: Pre,
props: Props,
table: Table,
Expand Down
10 changes: 10 additions & 0 deletions core/docz/src/components/AsyncPlayground.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'
import loadable from '@loadable/component'

const BasePlayground = loadable(() => import('./Playground'))
export const Playground: React.SFC<any> = props =>
typeof window !== 'undefined' ? (
<React.Suspense fallback={null}>
<BasePlayground {...props} />
</React.Suspense>
) : null
4 changes: 3 additions & 1 deletion core/docz/src/components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface PlaygroundProps {
__codesandbox: string
}

export const Playground: SFC<PlaygroundProps> = ({
const Playground: SFC<PlaygroundProps> = ({
className,
style,
wrapper: Wrapper,
Expand All @@ -40,3 +40,5 @@ export const Playground: SFC<PlaygroundProps> = ({
/>
)
}

export default Playground
2 changes: 1 addition & 1 deletion core/docz/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { Playground } from './components/AsyncPlayground'
export { AsyncRoute, loadRoute } from './components/AsyncRoute'
export { Link, LinkProps } from './components/Link'
export { Playground } from './components/Playground'
export { Props, PropsComponentProps } from './components/Props'
export { Routes } from './components/Routes'

Expand Down
1 change: 0 additions & 1 deletion core/gatsby-theme-docz/src/node/createPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const ENTRIES_QUERY = `
slug
name
menu
order
headings {
slug
depth
Expand Down
11 changes: 5 additions & 6 deletions core/gatsby-theme-docz/src/node/sourceNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const crypto = require('crypto')
const fs = require('fs-extra')
const { Entries, DataServer, states } = require('docz-core')
const { parseConfig } = require('../utils/parseConfig')
const { omit } = require('lodash/fp')

const digest = str =>
crypto
Expand Down Expand Up @@ -60,11 +59,11 @@ module.exports = async ({ actions, createNodeId }, opts) => {
})
}

await createDbNode()
await createEntriesNode()

dataServer.onStateChange(async () => {
const createNodes = async () => {
await createDbNode()
await createEntriesNode()
})
}

await createNodes()
dataServer.onStateChange(async () => createNodes())
}
1 change: 1 addition & 0 deletions examples/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scripts": {
"dev": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"format": "prettier --write \"src/**/*.js\""
},
"devDependencies": {
Expand Down

0 comments on commit dcc5f19

Please sign in to comment.