Client: adding NavBar

This commit is contained in:
SamR1 2017-12-17 12:27:07 +01:00
parent c5db180ede
commit 2a77b6d607
3 changed files with 47 additions and 34 deletions

View File

@ -4,37 +4,18 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000"> <meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!-- <link
Notice the use of %PUBLIC_URL% in the tags above. href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"
It will be replaced with the URL of the `public` folder during the build. rel="stylesheet"
Only files inside the `public` folder can be referenced from the HTML. >
<title>mpwo</title>
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head> </head>
<body> <body>
<noscript> <noscript>
You need to enable JavaScript to run this app. You need to enable JavaScript to run this app.
</noscript> </noscript>
<div id="root"></div> <div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body> </body>
</html> </html>

View File

@ -1,9 +1,9 @@
import React from 'react' import React from 'react'
import logo from '../logo.svg'
import './App.css' import './App.css'
import NavBar from './NavBar'
class App extends React.Component { export default class App extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.props = props this.props = props
@ -12,16 +12,11 @@ class App extends React.Component {
render() { render() {
return ( return (
<div className="App"> <div className="App">
<header className="App-header"> <NavBar />
<img src={logo} className="App-logo" alt="logo" /> <p className="App-body">
<h1 className="App-title">Welcome to React</h1> App in progress
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p> </p>
</div> </div>
) )
} }
} }
export default App

View File

@ -0,0 +1,37 @@
import React from 'react'
export default class NavBar extends React.Component {
constructor(props) {
super(props)
this.props = props
}
render() {
return (
<header>
<nav className="navbar navbar-expand-lg navbar-light bg-light">
<span className="navbar-brand">mpwo</span>
<button
className="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon" />
</button>
<div className="collapse navbar-collapse" id="navbarSupportedContent">
<ul className="navbar-nav mr-auto">
<li className="nav-item">
<a className="nav-link" href="/">Home</a>
</li>
</ul>
</div>
</nav>
</header>
)
}
}