Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky navbar #569

Merged
merged 2 commits into from
Apr 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions app/components/header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default class Header extends Component<Props, State> {
props: Props;

state: State = {
collapsed: true,
searchQuery: ''
};

Expand All @@ -51,24 +52,32 @@ export default class Header extends Component<Props, State> {
}
};

setCollapse = () => {
this.setState(prevState => ({
collapsed: !prevState.collapsed
}));
};

render(): Node {
const { activeMode, setActiveMode } = this.props;
const { searchQuery } = this.state;
const { collapsed, searchQuery } = this.state;

return (
<Navbar className="navbar navbar-expand-lg navbar-dark bg-dark col-sm-12 col-md-12">
<Navbar
className="navbar navbar-expand-lg navbar-dark bg-dark col-sm-12 col-md-12"
sticky="top"
>
<NavbarToggler
className="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-expanded={!collapsed}
aria-label="Toggle navigation"
onClick={this.setCollapse}
/>
<Collapse
className="collapse navbar-collapse"
id="navbarSupportedContent"
isOpen={!collapsed}
>
<Nav className="navbar-nav mr-auto">
<NavItem
Expand Down