Skip to content

Instantly share code, notes, and snippets.

@divyanshu013
Created December 30, 2017 12:54
Show Gist options
  • Save divyanshu013/af6b185dab294422a643d875c65a0b51 to your computer and use it in GitHub Desktop.
Save divyanshu013/af6b185dab294422a643d875c65a0b51 to your computer and use it in GitHub Desktop.
Header component for GitXplore app
import React, { Component } from 'react';
import SearchFilters from './SearchFilters';
class Header extends Component {
constructor(props) {
super(props);
this.state = {
visible: false,
};
}
toggleVisibility = () => {
const visible = !this.state.visible;
this.setState({
visible,
});
}
render() {
return (
<nav className={`navbar ${this.state.visible ? 'active' : ''}`}>
<div className="title">GitXplore</div>
<div className="btn toggle-btn" onClick={this.toggleVisibility}>Toggle Filters</div>
<SearchFilters {...this.props} visible={this.state.visible} />
</nav>
);
}
}
export default Header;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment