I have searched for Bootstrap 4 templates of a navbar with login and I came across this. So, I have converted it and this is the code:
import React, {Component} from 'react';
class HeaderComponent extends Component {
render() {
return (
<nav className="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div className="container">
<a className="navbar-brand" href="/">Reddit</a>
<button className="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar">
☰
</button>
<div className="collapse navbar-collapse" id="exCollapsingNavbar">
<ul className="nav navbar-nav">
<li className="nav-item"><a href="/" className="nav-link">Home</a></li>
<li className="nav-item"><a href="/" className="nav-link">Popular</a></li>
<li className="nav-item"><a href="/" className="nav-link">All</a></li>
</ul>
<ul className="nav navbar-nav flex-row justify-content-between ml-auto">
<li className="nav-item order-2 order-md-1"><a href="/" className="nav-link" title="settings"><i className="fa fa-cog fa-fw fa-lg"></i></a></li>
<li className="dropdown order-1">
<button type="button" id="dropdownMenu1" data-toggle="dropdown" className="btn btn-outline-secondary dropdown-toggle">Login <span className="caret"></span></button>
<ul className="dropdown-menu dropdown-menu-right mt-2">
<li className="px-3 py-2">
<form className="form">
<div className="form-group">
<input id="emailInput" placeholder="Email" className="form-control form-control-sm" type="text" required="" />
</div>
<div className="form-group">
<input id="passwordInput" placeholder="Password" className="form-control form-control-sm" type="text" required="" />
</div>
<div className="form-group">
<button type="submit" className="btn btn-primary btn-block">Login</button>
</div>
<div className="form-group text-center">
<small><a href="/" data-toggle="modal" data-target="#modalPassword">Forgot password?</a></small>
</div>
</form>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
)
}
}
export default HeaderComponent;
The problem here is the dropdown of the login option is not getting rendered. And when I minimize the window, all the options are hidden but pressing the button doesnt uncollapse the menu.