[Examples]: With react bootstrap (#12421)
* add new example with-react-bootstrap * use vanilla react-bootstrap components to implement index page * clear unnecessary comments * remove private property in package.json * Updates Co-authored-by: Luis Alvarez <luis@vercel.com>
This commit is contained in:
parent
a7b0e8a786
commit
4a8b896122
8 changed files with 184 additions and 0 deletions
42
examples/with-react-bootstrap/README.md
Normal file
42
examples/with-react-bootstrap/README.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Next.js with react-bootstrap example
|
||||
|
||||
This example shows how to use Next.js along with [react-bootstrap](https://react-bootstrap.github.io/).
|
||||
|
||||
## Deploy your own
|
||||
|
||||
Deploy the example using [Vercel](https://vercel.com):
|
||||
|
||||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/zeit/next.js/tree/canary/examples/with-react-bootstrap)
|
||||
|
||||
## How to use
|
||||
|
||||
### Using `create-next-app`
|
||||
|
||||
Execute [`create-next-app`](https://github.com/zeit/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
|
||||
npm init next-app --example with-react-bootstrap with-react-bootstrap-app
|
||||
# or
|
||||
yarn create next-app --example with-react-bootstrap with-react-bootstrap-app
|
||||
```
|
||||
|
||||
### Download manually
|
||||
|
||||
Download the example:
|
||||
|
||||
```bash
|
||||
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-react-bootstrap
|
||||
cd with-react-bootstrap
|
||||
```
|
||||
|
||||
Install it and run:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
# or
|
||||
yarn
|
||||
yarn dev
|
||||
```
|
||||
|
||||
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)).
|
18
examples/with-react-bootstrap/package.json
Normal file
18
examples/with-react-bootstrap/package.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "with-react-bootstrap",
|
||||
"version": "0.1.0",
|
||||
"author": "Wenzhi Li",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "^4.4.1",
|
||||
"next": "latest",
|
||||
"react": "^16.13.1",
|
||||
"react-bootstrap": "^1.0.1",
|
||||
"react-dom": "^16.13.1"
|
||||
}
|
||||
}
|
5
examples/with-react-bootstrap/pages/_app.jsx
Normal file
5
examples/with-react-bootstrap/pages/_app.jsx
Normal file
|
@ -0,0 +1,5 @@
|
|||
import '../style/index.css'
|
||||
|
||||
export default function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />
|
||||
}
|
89
examples/with-react-bootstrap/pages/index.jsx
Normal file
89
examples/with-react-bootstrap/pages/index.jsx
Normal file
|
@ -0,0 +1,89 @@
|
|||
import Head from 'next/head'
|
||||
import { Container, Row, Card, Button } from 'react-bootstrap'
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<Container className="md-container">
|
||||
<Head>
|
||||
<title>ReactJS with react-bootstrap</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 className="justify-content-md-between">
|
||||
<Card className="sml-card">
|
||||
<Card.Body>
|
||||
<Card.Title>Documentation</Card.Title>
|
||||
<Card.Text>
|
||||
Find in-depth information about Next.js features and API.
|
||||
</Card.Text>
|
||||
<Button variant="primary" href="https://nextjs.org/docs">
|
||||
More →
|
||||
</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
<Card className="sml-card">
|
||||
<Card.Body>
|
||||
<Card.Title>Learn</Card.Title>
|
||||
<Card.Text>
|
||||
Learn about Next.js in an interactive course with quizzes!
|
||||
</Card.Text>
|
||||
<Button variant="primary" href="https://nextjs.org/learn">
|
||||
More →
|
||||
</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Row>
|
||||
<Row className="justify-content-md-between">
|
||||
<Card className="sml-card">
|
||||
<Card.Body>
|
||||
<Card.Title>Examples</Card.Title>
|
||||
<Card.Text>
|
||||
Discover and deploy boilerplate example Next.js projects.
|
||||
</Card.Text>
|
||||
<Button
|
||||
variant="primary"
|
||||
href="https://github.com/zeit/next.js/tree/master/examples"
|
||||
>
|
||||
More →
|
||||
</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
<Card className="sml-card">
|
||||
<Card.Body>
|
||||
<Card.Title>Deploy</Card.Title>
|
||||
<Card.Text>
|
||||
Instantly deploy your Next.js site to a public URL with
|
||||
Vercel.
|
||||
</Card.Text>
|
||||
<Button
|
||||
variant="primary"
|
||||
href="https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=example&utm_campaign=next-example"
|
||||
>
|
||||
More →
|
||||
</Button>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</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-react-bootstrap/public/favicon-32x32.png
Normal file
BIN
examples/with-react-bootstrap/public/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 880 B |
BIN
examples/with-react-bootstrap/public/favicon.ico
Normal file
BIN
examples/with-react-bootstrap/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
4
examples/with-react-bootstrap/public/vercel.svg
Normal file
4
examples/with-react-bootstrap/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-react-bootstrap/style/index.css
Normal file
26
examples/with-react-bootstrap/style/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