Skip to content

Commit 5157621

Browse files
committed
✨ Add with-mdx example
1 parent 1af49ae commit 5157621

File tree

15 files changed

+191
-0
lines changed

15 files changed

+191
-0
lines changed

examples/with-mdx/.eslintrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
extends: 'plugin:nullstack/recommended',
3+
rules: {
4+
'nullstack/prettier': [
5+
'warn',
6+
{
7+
// More options at https://prettier.io/docs/en/options
8+
trailingComma: 'all',
9+
tabWidth: 2,
10+
semi: false,
11+
singleQuote: true,
12+
printWidth: 80,
13+
},
14+
{
15+
usePrettierrc: false,
16+
},
17+
],
18+
},
19+
}

examples/with-mdx/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
package-lock.json
8+
yarn.lock
9+
pnpm-lock.yaml
10+
11+
# testing
12+
/coverage
13+
14+
# misc
15+
.DS_Store
16+
*.pem
17+
18+
# debug
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*
22+
.pnpm-debug.log*
23+
24+
# local env files
25+
.env
26+
27+
# vercel
28+
.vercel
29+
30+
# bundle folders
31+
.development/
32+
.production/

examples/with-mdx/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Example app with MDX
2+
3+
This example shows using [MDX](https://github.com/mdx-js/mdx) as top level pages for your Nullstack app.
4+
5+
Based on the [fccoelho7/nullstack-mdx](https://github.com/fccoelho7/nullstack-mdx) with Tailwind ✨
6+
7+
## Deploy your own
8+
9+
Deploy it now with [Vercel](https://vercel.com) or preview on [StackBlitz](https://stackblitz.com):
10+
11+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/GuiDevloper/nullstack-examples/tree/main/examples/with-mdx&project-name=with-mdx&repo-name=with-mdx&demo-title=Nullstack+withMDX&demo-description=Nullstack+example+with+mdx&demo-url=https://github.com/GuiDevloper/nullstack-examples/tree/main/examples/with-mdx&demo-image=https://nullstack.app/image-1200x630.png)
12+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/GuiDevloper/nullstack-examples/tree/main/examples/with-mdx?title=Nullstack+WithMDX)
13+
14+
## How to use
15+
16+
Execute [`nulla create`](https://github.com/GuiDevloper/nulla) with [npm](https://docs.npmjs.com/cli/init):
17+
18+
```bash
19+
npx nulla create --example with-mdx with-mdx-app
20+
```
21+
22+
Then deploy it with [Vercel](https://github.com/GuiDevloper/nulla/blob/main/docs/en-US/deploy-vercel.md), [Heroku](https://github.com/GuiDevloper/nulla/blob/main/docs/en-US/deploy-heroku.md) or [Netlify](https://github.com/GuiDevloper/nulla/blob/main/docs/en-US/deploy-netlify.md).

examples/with-mdx/client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Nullstack from 'nullstack'
2+
3+
import Application from './src/Application'
4+
5+
export default Nullstack.start(Application)

examples/with-mdx/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"private": true,
3+
"devDependencies": {
4+
"nullstack": "0.20.0"
5+
},
6+
"scripts": {
7+
"start": "npx nullstack start",
8+
"build": "npx nullstack build",
9+
"vercel-build": "npm run build && npx nullstack-adapt-vercel"
10+
},
11+
"stackblitz": {
12+
"installDependencies": false,
13+
"startCommand": "npm i [email protected] -D && nullstack-adapt-babel && npm start",
14+
"compileTrigger": "save"
15+
},
16+
"dependencies": {
17+
"@mdx-js/loader": "^2.3.0"
18+
}
19+
}
930 Bytes
Loading

examples/with-mdx/server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Nullstack from 'nullstack'
2+
3+
import Application from './src/Application'
4+
5+
export default Nullstack.start(Application)

examples/with-mdx/src/Application.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* {
2+
padding: 0;
3+
margin: 0;
4+
text-decoration: none;
5+
list-style: none;
6+
box-sizing: border-box;
7+
}
8+
9+
body {
10+
background-color: #111827;
11+
color: #fff;
12+
font-family: sans-serif;
13+
}

examples/with-mdx/src/Application.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import './Application.css'
2+
import Nullstack from 'nullstack'
3+
4+
import Home from './Home.mdx'
5+
6+
class Application extends Nullstack {
7+
8+
render() {
9+
return (
10+
<main>
11+
<Home route="/" />
12+
</main>
13+
)
14+
}
15+
16+
}
17+
18+
export default Application

examples/with-mdx/src/Button.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.button {
2+
border-radius: 3px;
3+
border: 1px solid black;
4+
color: black;
5+
padding: 0.5em 1em;
6+
cursor: pointer;
7+
font-size: 1.1em;
8+
}

0 commit comments

Comments
 (0)