Created
December 30, 2017 12:54
-
-
Save divyanshu013/af6b185dab294422a643d875c65a0b51 to your computer and use it in GitHub Desktop.
Header component for GitXplore app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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