[refactor][xs]: rename docs directory to site reflecting fact this is the full website.

This commit is contained in:
Rufus Pollock
2021-07-28 09:27:17 +02:00
parent bb93103997
commit b81cf992de
25 changed files with 0 additions and 0 deletions

8
site/pages/_app.js Normal file
View File

@@ -0,0 +1,8 @@
import '../styles/globals.css'
import '../styles/tailwind.css'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
export default MyApp

5
site/pages/api/hello.js Normal file
View File

@@ -0,0 +1,5 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default (req, res) => {
res.status(200).json({ name: 'John Doe' })
}

View File

@@ -0,0 +1,52 @@
import path from 'path'
import * as fs from 'fs'
import Link from 'next/link'
import Layout from '../../components/layout'
import Prose from '../../components/prose'
import { formatMD } from '../../lib/utils'
export default function Docs({ title, mdFile }) {
return (
<Layout title="Portal.js Documentation - {title}">
<Prose mdFile={mdFile}>
</Prose>
</Layout>
)
}
const postsDirectory = 'markdowns/docs'
export async function getStaticProps({params}) {
const postId = params.id ? params.id : 'index'
const mdFilePath = path.join(postsDirectory, postId + '.md')
const mdFile = await formatMD(mdFilePath)
return {
props: {
mdFile
}
}
}
export async function getStaticPaths() {
const fileNames = fs.readdirSync(postsDirectory)
const paths = fileNames.map(fileName => {
if (fileName == 'index.md') {
return {
params: {
id: null
}
}
} else {
return {
params: {
id: [ fileName.replace(/\.md$/, '') ]
}
}
}
})
return {
paths: paths,
fallback: false
}
}

13
site/pages/gallery.js Normal file
View File

@@ -0,0 +1,13 @@
import Layout from '../components/layout'
import Prose from '../components/prose'
export default function Gallery() {
return (
<Layout title="Portal.js Gallery">
<Prose>
<p className="text-center">Come back soon!</p>
</Prose>
</Layout>
)
}

62
site/pages/index.js Normal file
View File

@@ -0,0 +1,62 @@
import Layout from '../components/layout'
export default function Home() {
return (
<Layout>
<main className="flex flex-col items-center justify-center w-full flex-1 px-20 text-center py-10">
<h1 className="text-6xl font-bold">
<a href="https://portaljs.com/">
<img src="/logo.svg" alt="PortalJS Logo" className="h-28" />
</a>
</h1>
<h2 className="mt-6 text-4xl font-normal leading-snug">
Rapidly build rich data portals using a modern frontend framework
</h2>
<div className="flex flex-wrap items-center justify-around max-w-4xl mt-6 sm:w-full">
<a
href="/docs/"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-semibold"> Documentation</h3>
<p className="mt-4 text-xl">
Find in-depth information about Portal.js features and API.
</p>
</a>
<a
href="/learn/"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-semibold"> Learn</h3>
<p className="mt-4 text-xl">
Learn about Portal.js in an interactive course.
</p>
</a>
<a
href="/gallery/"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-semibold"> Gallery</h3>
<p className="mt-4 text-xl">
Discover examples of Portal.js projects.
</p>
</a>
<a
href="https://github.com/datopian/portal.js"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-semibold"> Contribute</h3>
<p className="mt-4 text-xl">
Checkout the Portal.js repository on github
</p>
</a>
</div>
</main>
</Layout>
)
}

30
site/pages/learn.js Normal file
View File

@@ -0,0 +1,30 @@
import Link from 'next/link'
import path from 'path'
import Layout from '../components/layout'
import Prose from '../components/prose'
import { formatMD } from '../lib/utils'
export default function Docs({ mdFile }) {
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)
return {
props: {
mdFile
}
}
}