From 725e843d6d2d6b5ff3826bf31b632f30d3ecb646 Mon Sep 17 00:00:00 2001 From: Nityananda Gohain Date: Wed, 6 Mar 2019 19:57:48 +0530 Subject: [PATCH] Current Page Button hidden Now, when we are in home page then only "Add exercise" button is dispalyed and when we are in add exercise page only "Home" button is displayed. Fixes #23 --- src/components/Navbar.js | 52 +++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/src/components/Navbar.js b/src/components/Navbar.js index d701846d..54168aac 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -13,18 +13,51 @@ class Navbar extends Component { super(props); let {intl} = this.props; + this.state = { + displayHomeButton: false, + displayAddExerciseButton: true + } + } + + toggleButtons=()=>{ + this.setState({ + displayHomeButton: !this.state.displayHomeButton, + displayAddExerciseButton: !this.state.displayAddExerciseButton + }) } // redirect to new exercise template directToNew=()=>{ - this.props.history.push('/new') + this.props.history.push('/new'); + this.toggleButtons(); }; // redirect to home screen directToHome=()=>{ this.props.history.push('/') + this.toggleButtons(); }; + HomeButton=(homeTitle)=>{ + if(this.state.displayHomeButton){ + return