This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from RyanClementsHax/support-next-9-to-12
Support next 9 to 12
- Loading branch information
Showing
173 changed files
with
51,792 additions
and
1,451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "plugin:storybook/recommended"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 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 | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# storybook | ||
storybook-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
stories: [ | ||
'../stories/**/*.stories.mdx', | ||
'../stories/**/*.stories.@(js|jsx|ts|tsx)' | ||
], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'storybook-addon-next' | ||
], | ||
framework: '@storybook/react', | ||
core: { | ||
builder: 'webpack5' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import '../styles/globals.css' | ||
import '../styles/globals.scss' | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/ | ||
} | ||
}, | ||
nextRouter: { | ||
query: { | ||
foo: 'this-is-a-global-override' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Nextjs v10 Example | ||
|
||
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 | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `pages/index.js`. 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.js`. | ||
|
||
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. | ||
|
||
## 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Link from 'next/link' | ||
|
||
export const Links = () => ( | ||
<ul> | ||
<li> | ||
<Link href="/">Home</Link> | ||
</li> | ||
<li> | ||
<Link href="/nextjsRouting">Next.js Routing Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/nextjsImages">Next.js Images Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/globalStyleImports">Global Style Imports Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/cssModules">Css Module Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/scssModules">Scss Module Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/styledJsx">Styled JSX Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/absoluteImports">Absolute Import Example</Link> | ||
</li> | ||
<li> | ||
<Link href="/typescript">Typescript Example</Link> | ||
</li> | ||
</ul> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/** @type {import('react').FC} */ | ||
export const MyComponent = ({ children }) => <div>{children}</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
reactStrictMode: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "nextv10", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"storybook": "start-storybook -p 6006 -s public", | ||
"build-storybook": "build-storybook -s public" | ||
}, | ||
"dependencies": { | ||
"next": "^10.0.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"sass": "^1.49.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.16.7", | ||
"@storybook/addon-actions": "^6.4.9", | ||
"@storybook/addon-essentials": "^6.4.9", | ||
"@storybook/addon-links": "^6.4.9", | ||
"@storybook/builder-webpack5": "^6.4.9", | ||
"@storybook/manager-webpack5": "^6.4.9", | ||
"@storybook/react": "^6.4.9", | ||
"babel-loader": "^8.2.3", | ||
"eslint": "8.6.0", | ||
"eslint-config-next": "12.0.7", | ||
"eslint-plugin-storybook": "^0.5.5", | ||
"storybook-addon-next": "link:../../" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import '../styles/globals.css' | ||
import '../styles/globals.scss' | ||
|
||
/** @param {import('next/app').AppProps} props */ | ||
function MyApp({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
} | ||
|
||
export default MyApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Links } from 'components/Links' | ||
import { MyComponent } from 'components/MyComponent' | ||
import Head from 'next/head' | ||
|
||
export default function AbsoluteImports() { | ||
return ( | ||
<div> | ||
<Head> | ||
<title>Absolute Imports</title> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<Links /> | ||
<main> | ||
This uses an absolute import:{' '} | ||
<MyComponent>Im absolutely imported</MyComponent> | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Links } from 'components/Links' | ||
import Head from 'next/head' | ||
import styles from '../styles/CssModules.module.css' | ||
|
||
export default function CssModules() { | ||
return ( | ||
<div> | ||
<Head> | ||
<title>CSS Modules</title> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<Links /> | ||
<main className={styles.main}> | ||
<span>This is styled using CSS Modules</span> | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Links } from 'components/Links' | ||
import Head from 'next/head' | ||
|
||
export default function CssModules() { | ||
return ( | ||
<div> | ||
<Head> | ||
<title>Global style imports</title> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<Links /> | ||
<main> | ||
The background of this page is set by "styles/globals.scss" and this | ||
text size is set by "styles/globals.css". All global style imports need | ||
to be done in ".storybook/preview.js" for storybook. | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Links } from 'components/Links' | ||
import Head from 'next/head' | ||
|
||
export default function Home() { | ||
return ( | ||
<div> | ||
<Head> | ||
<title>Storybook Addon Next</title> | ||
<meta name="description" content="Generated by create next app" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<main> | ||
<h1> | ||
Click on any one of these links to see supported features in action | ||
</h1> | ||
<Links /> | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Links } from 'components/Links' | ||
import Image from 'next/image' | ||
import Head from 'next/head' | ||
|
||
export default function NextjsImages() { | ||
return ( | ||
<div> | ||
<Head> | ||
<title>Nextjs Images</title> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<Links /> | ||
<main> | ||
<h2>This image uses a remote image</h2> | ||
<Image src="/vercel.svg" alt="Vercel Logo" width={200} height={200} /> | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Links } from 'components/Links' | ||
import Head from 'next/head' | ||
import { useRouter } from 'next/router' | ||
|
||
export default function NextjsRouting() { | ||
const router = useRouter() | ||
console.log('this is the router NextjsRouting received 👉', router) | ||
return ( | ||
<div> | ||
<Head> | ||
<title>Nextjs Routing</title> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<Links /> | ||
<main> | ||
<p> | ||
Interact with any of the links and look at the "Actions" tab below (if | ||
in storybook) | ||
</p> | ||
<p> | ||
This is the router read by this page (functions not serialized; check | ||
the console for the full object): | ||
</p> | ||
<pre> | ||
<code>{JSON.stringify(router, null, 2)}</code> | ||
</pre> | ||
</main> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Links } from 'components/Links' | ||
import Head from 'next/head' | ||
import styles from '../styles/ScssModules.module.scss' | ||
|
||
export default function ScssModules() { | ||
return ( | ||
<div> | ||
<Head> | ||
<title>SCSS Modules</title> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<Links /> | ||
<main className={styles.main}> | ||
<span>This is styled using SCSS Modules</span> | ||
</main> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.