[docs][m]: refactor to have a common layout component for all pages and a common prose layout within that for "prose" docs (everything other than front page) - refs #559.

This commit is contained in:
Rufus Pollock
2021-06-15 19:24:12 +02:00
parent cd6c81e44b
commit 73bc3d1761
10 changed files with 127 additions and 169 deletions

View File

@@ -1,36 +1,24 @@
import Head from 'next/head'
import Link from 'next/link'
import path from 'path'
import Nav from '../components/Nav'
import Footer from '../components/Footer'
import Layout from '../components/layout'
import Prose from '../components/prose'
import { formatMD } from '../lib/utils'
export default function Docs({ mdFile }) {
return (
<>
<Head>
<title>Portal.js Api Documentation</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<Nav />
<div >
<div className="prose">
<div dangerouslySetInnerHTML={{ __html: mdFile }} />
</div>
<br />
<Link href="/references">
<button >Next Page</button>
</Link>
</div>
<Footer />
</>
)
return (
<Layout title="Portal.js - Learn">
<Prose mdFile={mdFile}>
<p className="text-center">
<Link href="/references">
<button>Next Page</button>
</Link>
</p>
</Prose>
</Layout>
)
}
export async function getStaticProps() {
const mdFilePath = path.join(process.cwd(), "markdowns/tutorial-doc/learn.md")
const mdFile = await formatMD(mdFilePath)
@@ -39,4 +27,4 @@ export async function getStaticProps() {
mdFile
}
}
}
}