Skip to content

Commit

Permalink
feat(docz-theme-default): add Loading component for DocPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jun 8, 2018
1 parent 270e38c commit 97859e2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/docz-theme-default/librc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ const svg = require('rollup-plugin-svg')

module.exports = {
plugins: [svg()],
commonjs: {
namedExports: {
'../../node_modules/react-spinners/index.js': ['HashLoader'],
},
},
}
22 changes: 22 additions & 0 deletions packages/docz-theme-default/src/components/ui/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as React from 'react'
import { ThemeConfig } from 'docz'
import { HashLoader } from 'react-spinners'
import styled from 'react-emotion'

const Wrapper = styled('div')`
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
`

export const Loading = () => (
<ThemeConfig>
{config => (
<Wrapper>
<HashLoader color={config.colors.primary} />
</Wrapper>
)}
</ThemeConfig>
)
1 change: 1 addition & 0 deletions packages/docz-theme-default/src/components/ui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export { H4 } from './H4'
export { H5 } from './H5'
export { H6 } from './H6'
export { List } from './List'
export { Loading } from './Loading'
export { Page } from './Page'
export { Pre } from './Pre'
export { Render } from './Render'
Expand Down
1 change: 1 addition & 0 deletions packages/docz-theme-default/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Theme = () => (
h5: components.H5,
h6: components.H6,
ul: components.List,
loading: components.Loading,
table: components.Table,
pre: components.Pre,
tooltip: components.Tooltip,
Expand Down
1 change: 1 addition & 0 deletions packages/docz-theme-default/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare module 'react-feather'
declare module 'react-powerplug'
declare module 'react-lightweight-tooltip'
declare module 'react-feather/dist/icons/chevron-down'
declare module 'react-spinners'

declare module '*.svg' {
const content: any
Expand Down

0 comments on commit 97859e2

Please sign in to comment.