Skip to content

Commit

Permalink
By click nav bottom item close sidebar if is open
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatrakazas committed Mar 29, 2024
1 parent ad1da8f commit 08adfca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/BottomNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IoIosTime, IoIosAddCircle, IoIosSend } from "react-icons/io";
import { useLocation, useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';

const BottomNav = () => {
const BottomNav = ({ isOpen, toggle }) => {
const location = useLocation();
const navigate = useNavigate();
const { t } = useTranslation();
Expand All @@ -19,6 +19,9 @@ const BottomNav = () => {
const handleNavigate = (path) => {
if (location.pathname !== path) {
navigate(path);
if (isOpen) {
toggle();
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const Layout = ({ children, isPermissionGranted, tokenSentInSession }) => {
</div>

{/* Bottom Nav menu */}
<BottomNav />
<BottomNav isOpen={isOpen} toggle={toggleSidebar} />
</div>
);
};
Expand Down

0 comments on commit 08adfca

Please sign in to comment.