From 7b9f4afe2425536a29d0e8c7e64c0ceefb2e50e7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 4 Nov 2021 11:33:31 -0400 Subject: [PATCH] Updating using touch and mouse up events. - Fixes #475 - Fixes #467 --- src/shared/components/app/navbar.tsx | 60 ++++++++++++++++++---------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/src/shared/components/app/navbar.tsx b/src/shared/components/app/navbar.tsx index e813c3c7..be88d33f 100644 --- a/src/shared/components/app/navbar.tsx +++ b/src/shared/components/app/navbar.tsx @@ -157,12 +157,13 @@ export class Navbar extends Component { {this.props.site_res.site_view && ( {this.props.site_res.site_view.site.icon && showAvatars() && ( { { { class="navbar-toggler border-0 p-1" type="button" aria-label="menu" - onClick={linkEvent(this, this.expandNavbar)} + onClick={linkEvent(this, this.handleToggleExpandNavbar)} data-tippy-content={i18n.t("expand_here")} > @@ -236,7 +239,8 @@ export class Navbar extends Component { {i18n.t("communities")} @@ -249,7 +253,8 @@ export class Navbar extends Component { prevPath: this.currentLocation, }} className="nav-link" - onClick={linkEvent(this, this.handleUnExpand)} + onTouchEnd={linkEvent(this, this.handleHideExpandNavbar)} + onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} title={i18n.t("create_post")} > {i18n.t("create_post")} @@ -260,7 +265,8 @@ export class Navbar extends Component { {i18n.t("create_community")} @@ -283,7 +289,8 @@ export class Navbar extends Component { @@ -331,6 +338,8 @@ export class Navbar extends Component { { {
  • @@ -401,7 +420,6 @@ export class Navbar extends Component { @@ -432,7 +450,8 @@ export class Navbar extends Component { {i18n.t("login")} @@ -442,7 +461,8 @@ export class Navbar extends Component { {i18n.t("sign_up")} @@ -456,11 +476,15 @@ export class Navbar extends Component { ); } - expandNavbar(i: Navbar) { + handleToggleExpandNavbar(i: Navbar) { i.state.expanded = !i.state.expanded; i.setState(i.state); } + handleHideExpandNavbar(i: Navbar) { + i.setState({ expanded: false, showDropdown: false }); + } + handleSearchParam(i: Navbar, event: any) { i.state.searchParam = event.target.value; i.setState(i.state); @@ -496,11 +520,7 @@ export class Navbar extends Component { location.reload(); } - handleUnExpand(i: Navbar) { - i.setState({ showDropdown: false, expanded: false }); - } - - handleShowDropdown(i: Navbar) { + handleToggleDropdown(i: Navbar) { i.state.showDropdown = !i.state.showDropdown; i.setState(i.state); }