Add with-reactstrap example (#15474)
## Summary This PR adds a Next.js example using [Reactsrap](https://reactstrap.github.io/)
This commit is contained in:
parent
ceeb6c3fce
commit
c154a878b6
9 changed files with 212 additions and 0 deletions
34
examples/with-reactstrap/.gitignore
vendored
Normal file
34
examples/with-reactstrap/.gitignore
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
# 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
|
21
examples/with-reactstrap/README.md
Normal file
21
examples/with-reactstrap/README.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# reactstrap Example
|
||||
|
||||
This example shows how to use Next.js with [reactstrap](https://reactstrap.github.io/).
|
||||
|
||||
## Deploy your own
|
||||
|
||||
Deploy the example using [Vercel](https://vercel.com):
|
||||
|
||||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/git?s=https://github.com/vercel/next.js/tree/canary/examples/with-reactstrap)
|
||||
|
||||
## How to use
|
||||
|
||||
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
|
||||
|
||||
```bash
|
||||
npx create-next-app --example with-reactstrap with-reactstrap-app
|
||||
# or
|
||||
yarn create next-app --example with-reactstrap with-reactstrap-app
|
||||
```
|
||||
|
||||
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
|
16
examples/with-reactstrap/package.json
Normal file
16
examples/with-reactstrap/package.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "with-reactstrap",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "^4.5.0",
|
||||
"next": "latest",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"reactstrap": "^8.5.1"
|
||||
}
|
||||
}
|
5
examples/with-reactstrap/pages/_app.jsx
Normal file
5
examples/with-reactstrap/pages/_app.jsx
Normal file
|
@ -0,0 +1,5 @@
|
|||
import '../styles/index.css'
|
||||
|
||||
export default function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />
|
||||
}
|
106
examples/with-reactstrap/pages/index.jsx
Normal file
106
examples/with-reactstrap/pages/index.jsx
Normal file
|
@ -0,0 +1,106 @@
|
|||
import Head from 'next/head'
|
||||
import {
|
||||
Container,
|
||||
Row,
|
||||
Col,
|
||||
Button,
|
||||
Card,
|
||||
CardText,
|
||||
CardTitle,
|
||||
CardBody,
|
||||
} from 'reactstrap'
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<Container className="md-container">
|
||||
<Head>
|
||||
<title>ReactJS with reactstrap</title>
|
||||
<link rel="icon" href="/favicon-32x32.png" />
|
||||
</Head>
|
||||
<Container>
|
||||
<h1>
|
||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
||||
</h1>
|
||||
<p>
|
||||
Get started by editing <code>pages/index.js</code>
|
||||
</p>
|
||||
<Container>
|
||||
<Row>
|
||||
<Col sm="6">
|
||||
<Card className="my-3">
|
||||
<CardBody>
|
||||
<CardTitle tag="h5">Documentation</CardTitle>
|
||||
<CardText>
|
||||
Find in-depth information about Next.js features and API.
|
||||
</CardText>
|
||||
<Button color="primary" href="https://nextjs.org/docs">
|
||||
More →
|
||||
</Button>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col sm="6">
|
||||
<Card className="my-3">
|
||||
<CardBody>
|
||||
<CardTitle tag="h5">Learn</CardTitle>
|
||||
<CardText>
|
||||
Learn about Next.js in an interactive course with quizzes!
|
||||
</CardText>
|
||||
<Button color="primary" href="https://nextjs.org/learn">
|
||||
More →
|
||||
</Button>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col sm="6">
|
||||
<Card className="my-3">
|
||||
<CardBody>
|
||||
<CardTitle tag="h5">Examples</CardTitle>
|
||||
<CardText>
|
||||
Discover and deploy boilerplate example Next.js projects.
|
||||
</CardText>
|
||||
<Button
|
||||
color="primary"
|
||||
href="https://github.com/vercel/next.js/tree/master/examples"
|
||||
>
|
||||
More →
|
||||
</Button>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col sm="6">
|
||||
<Card className="my-3">
|
||||
<CardBody>
|
||||
<CardTitle tag="h5">Deploy</CardTitle>
|
||||
<CardText>
|
||||
Instantly deploy your Next.js site to a public URL with
|
||||
Vercel.
|
||||
</CardText>
|
||||
<Button
|
||||
color="primary"
|
||||
href="https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=example&utm_campaign=next-example"
|
||||
>
|
||||
More →
|
||||
</Button>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
</Container>
|
||||
|
||||
<footer className="cntr-footer">
|
||||
<a
|
||||
href="https://vercel.com?filter=next.js&utm_source=github&utm_medium=example&utm_campaign=next-example"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Powered by{' '}
|
||||
<img src="/vercel.svg" alt="Vercel Logo" className="sml-logo" />
|
||||
</a>
|
||||
</footer>
|
||||
</Container>
|
||||
)
|
||||
}
|
BIN
examples/with-reactstrap/public/favicon-32x32.png
Normal file
BIN
examples/with-reactstrap/public/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 880 B |
BIN
examples/with-reactstrap/public/favicon.ico
Normal file
BIN
examples/with-reactstrap/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
4
examples/with-reactstrap/public/vercel.svg
Normal file
4
examples/with-reactstrap/public/vercel.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
26
examples/with-reactstrap/styles/index.css
Normal file
26
examples/with-reactstrap/styles/index.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* ensure all pages have Bootstrap CSS */
|
||||
@import '~bootstrap/dist/css/bootstrap.min.css';
|
||||
|
||||
.md-container {
|
||||
max-width: 800px;
|
||||
padding-top: 2rem;
|
||||
}
|
||||
|
||||
.sml-card {
|
||||
width: 22rem;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.cntr-footer {
|
||||
height: 80px;
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.sml-logo {
|
||||
height: 1em;
|
||||
margin-left: 10px;
|
||||
}
|
Loading…
Reference in a new issue