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

Commit b848645

Browse files
committed
Convert to a Next/MDX site
1 parent c353584 commit b848645

File tree

11 files changed

+8350
-122
lines changed

11 files changed

+8350
-122
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.next
12
node_modules
23
public/build
34
yarn.lock

components/CodeSample.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import dedent from 'dedent'
2+
import Highlight from 'react-highlight'
3+
4+
export default (props) => {
5+
const formattedCode = dedent`${props.code}`
6+
7+
const preview = () => {
8+
if (props.children) {
9+
return (
10+
<div>
11+
{props.children}
12+
</div>
13+
)
14+
} else {
15+
return (
16+
<div dangerouslySetInnerHTML={{ __html: formattedCode }}/>
17+
)
18+
}
19+
}
20+
21+
return (
22+
<div className="relative overflow-hidden mb-8">
23+
<div className="bg-white rounded-t-lg overflow-hidden border-t border-l border-r border-gray-400 p-4">
24+
<div className="max-w-sm mx-auto">{preview()}</div>
25+
</div>
26+
<div className="rounded-b-lg p-4 bg-gray-800">
27+
<Highlight className="language-html">{formattedCode}</Highlight>
28+
</div>
29+
</div>
30+
)
31+
}

components/Layout.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import '../static/css/tailwind.css'
2+
import { MDXProvider } from '@mdx-js/react'
3+
import Head from 'next/head'
4+
5+
export default ({ meta, children }) => {
6+
return (
7+
<div class="antialiased text-gray-900">
8+
<Head>
9+
<title>{meta.title}</title>
10+
</Head>
11+
<div className="max-w-3xl w-full mx-auto px-6 py-12">
12+
<div className="markdown">
13+
{ children }
14+
</div>
15+
</div>
16+
</div>
17+
)
18+
}

next.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const withCSS = require('@zeit/next-css')
2+
const withMDX = require('@next/mdx')()
3+
4+
module.exports = withCSS(withMDX({
5+
pageExtensions: ['js', 'jsx', 'mdx']
6+
}))

0 commit comments

Comments
 (0)