Skip to content
This repository was archived by the owner on Sep 11, 2021. It is now read-only.

Replace customization API #18

Merged
merged 6 commits into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/components/CodeBlock.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Highlight from 'react-highlight'

export default ({ children, className }) => (
<div className="rounded-lg p-6 bg-gray-800 overflow-x-auto text-gray-400 text-sm">
<Highlight className={`language-${className.replace(/language-/, '')}`}>{children}</Highlight>
</div>
)
13 changes: 10 additions & 3 deletions docs/components/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import '../static/css/tailwind.css'
import { MDXProvider } from '@mdx-js/react'
import Head from 'next/head'
import CodeBlock from './CodeBlock'

const components = {
code: CodeBlock,
}

export default ({ meta, children }) => {
return (
@@ -9,9 +14,11 @@ export default ({ meta, children }) => {
<title>{meta.title}</title>
</Head>
<div className="max-w-3xl w-full mx-auto px-6 py-12">
<div className="markdown">
{ children }
</div>
<MDXProvider components={components}>
<div className="markdown">
{ children }
</div>
</MDXProvider>
</div>
</div>
)
Loading