Skip to content

Commit fa4e4b7

Browse files
committed
added mdx provider and components
1 parent b2ac35b commit fa4e4b7

File tree

1 file changed

+75
-55
lines changed

1 file changed

+75
-55
lines changed

src/templates/layout.js

Lines changed: 75 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import {
1919
Input,
2020
Button,
2121
} from "@chakra-ui/core"
22+
import { MDXProvider } from "@mdx-js/react"
2223
import { P, B } from "../components/typography"
24+
import * as Typography from "../components/typography"
2325
import styled from "@emotion/styled"
2426
import { Global } from "@emotion/core"
2527
import Img from "gatsby-image"
@@ -241,66 +243,84 @@ const Layout = ({ children }) => (
241243
render={data => (
242244
<ThemeProvider theme={customTheme}>
243245
<ColorModeProvider>
244-
<Box bg="rgb(247,245,242)" minHeigh="100vh">
245-
<Global
246-
styles={{
247-
'a:visited': {
248-
color: 'inherit',
249-
},
250-
'a:hover': {
251-
cursor: 'pointer',
252-
},
253-
'body': {
254-
fontFamily: customTheme.fonts.body,
255-
color: customTheme.colors.primary,
256-
lineHeight: customTheme.lineHeights[1],
257-
},
258-
'*': {
259-
boxSizing: 'border-box',
260-
}
261-
}}
262-
/>
263-
<Box maxWidth='maxContainerWidth' mx={['1', 'auto']} fontSize={[1,'desktop.1']}>
264-
<Helmet
265-
meta={[
266-
{ name: "referrer", content: "origin" },
267-
{
268-
name: "google-site-verification",
269-
content: "M4VnkYHL0o4WjZUo7XZO-_HUIjsZGo2Bvw-SGI3VF80",
246+
<MDXProvider
247+
components={{
248+
// Map HTML element tag to React component
249+
h1: Typography.H1,
250+
h2: Typography.H2,
251+
h3: Typography.H3,
252+
h4: Typography.H4,
253+
h5: Typography.H5,
254+
p: Typography.P,
255+
b: Typography.B,
256+
em: Typography.Em,
257+
i: Typography.I,
258+
ul: Typography.Ul,
259+
ol: Typography.Ol,
260+
li: Typography.Li,
261+
}}
262+
>
263+
<Box bg="rgb(247,245,242)" minHeigh="100vh">
264+
<Global
265+
styles={{
266+
'a:visited': {
267+
color: 'inherit',
270268
},
271-
]}
269+
'a:hover': {
270+
cursor: 'pointer',
271+
},
272+
'body': {
273+
fontFamily: customTheme.fonts.body,
274+
color: customTheme.colors.primary,
275+
lineHeight: customTheme.lineHeights[1],
276+
},
277+
'*': {
278+
boxSizing: 'border-box',
279+
}
280+
}}
272281
/>
273-
<Helmet>
274-
<script
275-
async
276-
src="https://www.googletagmanager.com/gtag/js?id=AW-700131916"
277-
></script>
278-
<script>
279-
{`
280-
window.dataLayer = window.dataLayer || [];
281-
function gtag(){dataLayer.push(arguments);}
282-
gtag('js', new Date());
283-
284-
gtag('config', 'AW-700131916');
282+
<Box maxWidth='maxContainerWidth' mx={['1', 'auto']} fontSize={[1,'desktop.1']}>
283+
<Helmet
284+
meta={[
285+
{ name: "referrer", content: "origin" },
286+
{
287+
name: "google-site-verification",
288+
content: "M4VnkYHL0o4WjZUo7XZO-_HUIjsZGo2Bvw-SGI3VF80",
289+
},
290+
]}
291+
/>
292+
<Helmet>
293+
<script
294+
async
295+
src="https://www.googletagmanager.com/gtag/js?id=AW-700131916"
296+
></script>
297+
<script>
298+
{`
299+
window.dataLayer = window.dataLayer || [];
300+
function gtag(){dataLayer.push(arguments);}
301+
gtag('js', new Date());
302+
303+
gtag('config', 'AW-700131916');
285304
286-
document.addEventListener('click',function(e){
287-
if(e.target.matches('[href="tel:+14845060634"]')){
288-
gtag('event', 'conversion', {'send_to': 'AW-700131916/co9tCKqOrLUBEMzU7M0C'});
289-
ga('send','event','button','click','phone');
290-
}
291-
})
292-
`}
293-
</script>
294-
</Helmet>
295-
<Header siteTitle={data.site.siteMetadata.title} />
296-
<Box>
297-
<main>{children}</main>
298-
<footer>
299-
<Footer images={data} />
300-
</footer>
305+
document.addEventListener('click',function(e){
306+
if(e.target.matches('[href="tel:+14845060634"]')){
307+
gtag('event', 'conversion', {'send_to': 'AW-700131916/co9tCKqOrLUBEMzU7M0C'});
308+
ga('send','event','button','click','phone');
309+
}
310+
})
311+
`}
312+
</script>
313+
</Helmet>
314+
<Header siteTitle={data.site.siteMetadata.title} />
315+
<Box>
316+
<main>{children}</main>
317+
<footer>
318+
<Footer images={data} />
319+
</footer>
320+
</Box>
301321
</Box>
302322
</Box>
303-
</Box>
323+
</MDXProvider>
304324
</ColorModeProvider>
305325
</ThemeProvider>
306326
)}

0 commit comments

Comments
 (0)