-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
index.tsx
72 lines (64 loc) · 1.84 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import 'rc-tooltip/assets/bootstrap.css'
import './styles/global'
import * as React from 'react'
import { theme, DocPreview, ThemeConfig } from 'docz'
import { ThemeProvider } from 'emotion-theming'
import webfont from 'webfontloader'
import { config } from './config'
import { mq } from './styles/responsive'
import * as components from './components/ui'
import * as modes from './styles/modes'
// tslint:disable
const mergeTheme = (config: any) => (old: any) => ({
...old,
docz: Object.assign({}, config.themeConfig, { mq }),
})
const Theme = () => (
<ThemeConfig>
{config => (
<ThemeProvider theme={mergeTheme(config)}>
<DocPreview
components={{
page: components.Page,
notFound: components.NotFound,
render: components.Render,
blockquote: components.Blockquote,
h1: components.H1,
h2: components.H2,
h3: components.H3,
h4: components.H4,
h5: components.H5,
h6: components.H6,
hr: components.Hr,
ul: components.List,
p: components.Paragraph,
a: components.Link,
inlineCode: components.InlineCode,
loading: components.Loading,
table: components.Table,
pre: components.Pre,
tooltip: components.Tooltip,
}}
/>
</ThemeProvider>
)}
</ThemeConfig>
)
webfont.load({
google: {
families: ['Source Code Pro', 'Source Sans Pro:300,400,600,700'],
},
})
const transform = ({ mode, codemirrorTheme, ...config }: any) => {
const selectedMode: any = (modes as any)[mode]
return {
...config,
mode,
codemirrorTheme: codemirrorTheme || `docz-${mode}`,
colors: {
...selectedMode,
...config.colors,
},
}
}
export default theme(config, transform)(Theme)