Skip to content

Commit

Permalink
docs: 📝 initialize Next.js landing page with MDX and Mantine for docu…
Browse files Browse the repository at this point in the history
…mentation
  • Loading branch information
Dan6erbond committed May 21, 2023
1 parent ddefe1b commit 1687a69
Show file tree
Hide file tree
Showing 15 changed files with 4,412 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"tagger",
"search",
"frontend"
]
],
"[mdx]": {
"editor.wordWrap": "on"
}
}
3 changes: 3 additions & 0 deletions docs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
35 changes: 35 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
38 changes: 38 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
23 changes: 23 additions & 0 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import mdx from "@next/mdx";
import remarkGfm from "remark-gfm";

const withMDX = mdx({
extension: /\.mdx?$/,
options: {
// If you use remark-gfm, you'll need to use next.config.mjs
// as the package is ESM only
// https://github.com/remarkjs/remark-gfm#install
remarkPlugins: [remarkGfm],
rehypePlugins: [],
// If you use `MDXProvider`, uncomment the following line.
providerImportSource: "@mdx-js/react",
},
});

/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
reactStrictMode: true,
};

export default withMDX(nextConfig);
42 changes: 42 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "docs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@emotion/react": "^11.11.0",
"@emotion/server": "^11.11.0",
"@mantine/carousel": "^6.0.11",
"@mantine/core": "^6.0.11",
"@mantine/dates": "^6.0.11",
"@mantine/hooks": "^6.0.11",
"@mantine/modals": "^6.0.11",
"@mantine/next": "^6.0.11",
"@mantine/nprogress": "^6.0.11",
"@mantine/prism": "^6.0.11",
"@mantine/spotlight": "^6.0.11",
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.3",
"@types/lunr": "^2.3.4",
"@types/node": "20.2.1",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"dayjs": "^1.11.7",
"embla-carousel-react": "^8.0.0-rc04",
"eslint": "8.41.0",
"eslint-config-next": "13.4.3",
"lunr": "^2.3.9",
"next": "13.4.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.8.0",
"remark-gfm": "^3.0.1",
"typescript": "5.0.4"
}
}
Binary file added docs/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions docs/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions docs/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Code, MantineProvider } from "@mantine/core";
import { Prism } from "@mantine/prism";
import { MDXProvider } from "@mdx-js/react";
import { AppProps } from "next/app";
import Head from "next/head";
import Image from "next/image";
import { DetailedHTMLProps, HTMLAttributes } from "react";

export default function App(props: AppProps) {
const { Component, pageProps } = props;

return (
<>
<Head>
<title>Page title</title>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width"
/>
</Head>

<MantineProvider
withGlobalStyles
withNormalizeCSS
theme={{
/** Put your mantine theme override here */
colorScheme: "dark",
}}
>
<MDXProvider
components={{
pre: (props) => {
const className = (props as any).children.props.className || "";
const code = (props as any).children.props.children.trim();
const language = className.replace(/language-/, "");

return <Prism language={language}>{code}</Prism>;
},
code: (props) => {
return <Code {...(props as any)} />;
},
img: (props) => {
return (
<div style={{ maxWidth: "100%" }}>
<img {...props} style={{ maxWidth: "100%" }} />
<span
style={{
margin: "0.5rem auto 0 auto",
display: "block",
textAlign: "center",
}}
>
{props.alt}
</span>
</div>
);
},
}}
>
<Component {...pageProps} />
</MDXProvider>
</MantineProvider>
</>
);
}
20 changes: 20 additions & 0 deletions docs/src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { createGetInitialProps } from "@mantine/next";
import Document, { Head, Html, Main, NextScript } from "next/document";

const getInitialProps = createGetInitialProps();

export default class _Document extends Document {
static getInitialProps = getInitialProps;

render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
14 changes: 14 additions & 0 deletions docs/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Head from "next/head";

export default function Home() {
return (
<>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
</>
);
}
23 changes: 23 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 1687a69

Please sign in to comment.