-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-browser.js
93 lines (87 loc) · 1.81 KB
/
gatsby-browser.js
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* eslint-disable */
import React from "react"
import { css, Global } from "@emotion/core"
import { MDXProvider } from "@mdx-js/react"
import { AppContextProvider } from './src/context/AppContext'
import Link from './src/components/Link'
import HighlightCode from './src/components/markdown/HighlightCode'
import globalStyles from './src/styles/global'
import { linkHighlighted } from './src/styles/shared'
import './src/styles/global.css'
import 'normalize.css/normalize.css'
const components = {
a: (props) => (
<Link
css={[
linkHighlighted,
css`
padding: 4px 0;
&:hover { background-color: transparent; }
`,
]}
target="_blank"
{...props}
/>
),
pre: ({ children: { props }}) => (
<HighlightCode
language={props.className && props.className.split(`-`)[1]}
code={props.children}
/>
),
inlineCode: ({ children }) => (
<HighlightCode
inline
code={children}
/>
),
h2: (props) => (
<h2
css={css`
font-size: 2.6rem;
margin-top: 6rem;
margin-bottom: 2rem;
`}
{...props}
/>
),
h3: (props) => (
<h3
css={css`
font-size: 2rem;
margin-top: 2rem;
margin-bottom: 1rem;
`}
{...props}
/>
),
ul: (props) => (
<ul
css={css`margin: 2rem auto;`}
{...props}
/>
),
ol: (props) => (
<ol
css={css`padding-left: 2rem;`}
{...props}
/>
),
li: (props) => (
<li
css={css`
margin: 1rem auto;
line-height: 1.6;
`}
{...props}
/>
),
}
export const wrapRootElement = ({ element }) => (
<AppContextProvider>
<Global styles={globalStyles} />
<MDXProvider components={components}>
{element}
</MDXProvider>
</AppContextProvider>
)