Commit 728fe74e authored by RyotArch's avatar RyotArch Committed by Luis Fernando Alvarez D

Added example for rbx and bulma-pro (#7728)

parent a4355b0d
# rbx & bulma-pro example
## How to use
### Using `create-next-app`
Execute create-next-app with yarn or npm to bootstrap the example:
```
npm create-next-app --example with-rbx-bulma-pro with-rbx-bulma-pro-app
# or
yarn create next-app --example with-rbx-bulma-pro with-rbx-bulma-pro-app
```
### Download manually
Download the example:
```
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-rbx-bulma-pro
cd with-rbx-bulma-pro
```
Install it and run:
```
npm install
npm run dev
# or
yarn
yarn dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```
now
```
## The idea behind the example
This example shows how to use Next.js along with [rbx](https://github.com/dfee/rbx)(Bulma UI Framework for react) and [Bulma Pro](https://mubaidr.js.org/bulma-pro/).
import Link from 'next/link'
import {
Generic,
Container,
Content,
Navbar,
Section,
Hero,
Title,
Footer
} from 'rbx'
import 'bulma-pro/css/bulma.css'
const Layout = ({ children }) => {
return (
<Generic>
<Navbar fixed='top' color='primary'>
<Navbar.Brand>
<Navbar.Item href='#'>Bulma</Navbar.Item>
<Navbar.Burger />
</Navbar.Brand>
<Navbar.Menu>
<Navbar.Segment align='start'>
<Link href='/'>
<Navbar.Item>Home</Navbar.Item>
</Link>
<Link href='/about'>
<Navbar.Item>About</Navbar.Item>
</Link>
<Link href='/contact'>
<Navbar.Item>Contact</Navbar.Item>
</Link>
</Navbar.Segment>
</Navbar.Menu>
</Navbar>
<Section backgroundColor='primary'>
<Hero>
<Hero.Body>
<Container>
<Title as='h1' align='center' color='white'>
Welcome to Next!
</Title>
</Container>
</Hero.Body>
</Hero>
</Section>
<Container>
<Content>{children}</Content>
</Container>
<Footer>
<Content textAlign='centered'>
<p>&copy; ZEIT, Inc. All rights reserved.</p>
</Content>
</Footer>
</Generic>
)
}
export default Layout
const withCSS = require('@zeit/next-css')
module.exports = withCSS({
webpack: config => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty'
}
return config
}
})
{
"name": "with-rbx-bulma-pro",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@zeit/next-css": "1.0.1",
"bulma-pro": "^0.1.7",
"next": "8.1.0",
"rbx": "^2.2.0",
"react": "16.8.6",
"react-dom": "16.8.6"
}
}
import { Section, Title } from 'rbx'
import Layout from '../components/Layout'
const AboutPage = () => (
<Layout>
<Section>
<Title as='h2'>About</Title>
<ul>
<li>Server-rendered by default</li>
<li>Automatic code splitting for faster page loads</li>
<li>Simple client-side routing (page based)</li>
<li>Filesystem based router, including dynamic routes</li>
<li>
Webpack-based dev environment which supports Hot Module Replacement
(HMR)
</li>
<li>Serverless support</li>
<li>Customizable with your own Babel and Webpack configurations</li>
</ul>
</Section>
</Layout>
)
export default AboutPage
import {
Section,
Title,
Field,
Label,
Control,
Input,
Textarea,
Button
} from 'rbx'
import Layout from '../components/Layout'
const ContactPage = () => (
<Layout>
<Section>
<Title as='h2'>Contact Form Example</Title>
<Field>
<Label>Name</Label>
<Control>
<Input type='text' name='name' placeholder='your name' />
</Control>
</Field>
<Field>
<Label>Email</Label>
<Control>
<Input type='email' name='email' placeholder='your email' />
</Control>
</Field>
<Field>
<Label>Subject</Label>
<Control>
<Input type='text' name='subject' placeholder='your subject' />
</Control>
</Field>
<Field>
<Label>Message</Label>
<Control>
<Textarea name='message' rows={10} placeholder='your message' />
</Control>
</Field>
<Button.Group align='right'>
<Button color='primary' key='submit'>
Submit
</Button>
</Button.Group>
</Section>
</Layout>
)
export default ContactPage
import Link from 'next/link'
import { Section, Card, Content, Title } from 'rbx'
import Layout from '../components/Layout'
const Home = () => (
<Layout>
<Section>
<Card>
<Card.Content>
<Content>
<Link href='https://github.com/zeit/next.js#getting-started'>
<a>
<Title as='h3'>Getting Started &rarr;</Title>
<p>Learn more about Next on Github and in their examples</p>
</a>
</Link>
</Content>
</Card.Content>
</Card>
<Card>
<Card.Content>
<Content>
<Link href='https://open.segment.com/create-next-app'>
<a>
<Title as='h3'>Examples &rarr;</Title>
<p>
Find other example boilerplates on the{' '}
<code>create-next-app</code> site
</p>
</a>
</Link>
</Content>
</Card.Content>
</Card>
<Card>
<Card.Content>
<Content>
<Link href='https://github.com/segmentio/create-next-app'>
<a>
<Title as='h3'>Create Next App &rarr;</Title>
<p>Was this tool helpful? Let us know how we can improve it</p>
</a>
</Link>
</Content>
</Card.Content>
</Card>
</Section>
</Layout>
)
export default Home
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment