make navbar responsive
This commit is contained in:
parent
a63498826b
commit
47d9ab355a
@ -1,41 +1,59 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
function Navbar(props) {
|
function Navbar(props) {
|
||||||
// props are passed from App as {...this.state}
|
|
||||||
return (
|
return (
|
||||||
<nav className="navbar navbar-light bg-light">
|
<nav className="navbar navbar-expand-lg navbar-light bg-light">
|
||||||
<div className="navbar-brand ml-2">{props.appname}</div>
|
<a
|
||||||
|
className="navbar-brand"
|
||||||
<div
|
href="#profile"
|
||||||
className={`nav-item mr-3 ${props.component === 'about' ? 'active' : ''}`}
|
onClick={() => props.navigate('profile')}
|
||||||
onClick={() => props.navigate('projects')}
|
|
||||||
>
|
>
|
||||||
Projects
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
className={`nav-item mr-3 ${props.component === 'tasks' ? 'active' : ''}`}
|
|
||||||
onClick={() => props.navigate('tasks')}
|
|
||||||
>
|
|
||||||
Tasks
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
className={`nav-item mr-3 ${props.component === 'about' ? 'active' : ''}`}
|
|
||||||
onClick={() => props.navigate('about')}
|
|
||||||
>
|
|
||||||
About
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="ml-auto>" onClick={() => props.navigate('profile')}>
|
|
||||||
<img
|
|
||||||
className="rounded-circle mr-1"
|
|
||||||
alt={props.user.name}
|
|
||||||
width="16px"
|
|
||||||
height="16px"
|
|
||||||
src="/img/default-user-image.png"
|
|
||||||
/>
|
|
||||||
{`Hello, ${props.user.name}!`}
|
{`Hello, ${props.user.name}!`}
|
||||||
|
</a>
|
||||||
|
<button
|
||||||
|
className="navbar-toggler"
|
||||||
|
type="button"
|
||||||
|
data-toggle="collapse"
|
||||||
|
data-target="#navbarText"
|
||||||
|
aria-controls="navbarText"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-label="Toggle navigation"
|
||||||
|
>
|
||||||
|
<span className="navbar-toggler-icon" />
|
||||||
|
</button>
|
||||||
|
<div className="collapse navbar-collapse" id="navbarText">
|
||||||
|
<ul className="navbar-nav mr-auto">
|
||||||
|
<li
|
||||||
|
className={`nav-item ${
|
||||||
|
props.component === 'project' ? 'active' : ''
|
||||||
|
}`}
|
||||||
|
onClick={() => props.navigate('project')}
|
||||||
|
>
|
||||||
|
<a className="nav-link" href="#project">
|
||||||
|
Projects
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={`nav-item ${
|
||||||
|
props.component === 'tasks' ? 'active' : ''
|
||||||
|
}`}
|
||||||
|
onClick={() => props.navigate('tasks')}
|
||||||
|
>
|
||||||
|
<a className="nav-link" href="#tasks">
|
||||||
|
Tasks
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={`nav-item ${
|
||||||
|
props.component === 'about' ? 'active' : ''
|
||||||
|
}`}
|
||||||
|
onClick={() => props.navigate('about')}
|
||||||
|
>
|
||||||
|
<a className="nav-link" href="#about">
|
||||||
|
About
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user