diff --git a/src/components/MobileNav.component.jsx b/src/components/MobileNav.component.jsx index 7e08696..bd7abd1 100644 --- a/src/components/MobileNav.component.jsx +++ b/src/components/MobileNav.component.jsx @@ -5,6 +5,20 @@ import { NavLink as Link, withRouter } from 'react-router-dom' import '../css/MobileNav.styles.css' class MobileNav extends Component { + constructor(props) { + super(props); + this.state = { + isToggleOn: false + }; + this.handleClick = this.handleClick.bind(this); + } + + handleClick() { + this.setState(state => ({ + isToggleOn: !state.isToggleOn + })); + } + render() { const location = { '/': 'Home', @@ -14,12 +28,14 @@ class MobileNav extends Component { '/settings': 'Settings' } - const { podcast = 'Loading...', theme } = this.props - const { pathname } = this.props.location + const { podcast = 'Loading...', theme } = this.props; + const { pathname } = this.props.location; const formattedPodcastName = podcast.length > 15 ? podcast.substring(0, 15) + '...' : podcast + const { isToggleOn } = this.state; + return (