forked from layer5io/layer5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
root-wrapper.js
34 lines (32 loc) · 939 Bytes
/
root-wrapper.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
import React from "react";
import { MDXProvider } from "@mdx-js/react";
import Code from "./src/components/CodeBlock";
import CTA_ImageOnly from "./src/components/Call-To-Actions/CTA_ImageOnly";
import CTA_FullWidth from "./src/components/Call-To-Actions/CTA_FullWidth";
import CTA_Bottom from "./src/components/Call-To-Actions/CTA_Bottom";
import { ContextWrapper } from "./context-wrapper";
const components = {
pre: ({ children: { props } }) => {
if (props.mdxType === "code") {
return (
<Code
codeString={props.children.trim()}
language={
props.className && props.className.replace("language-", "")
}
{...props}
/>
);
}
},
CTA_ImageOnly,
CTA_FullWidth,
CTA_Bottom
};
export const wrapRootElement = ({ element }) => (
<ContextWrapper>
<MDXProvider components={components}>
{element}
</MDXProvider>
</ContextWrapper>
);