Skip to content

Commit 08adfca

Browse files
committed
By click nav bottom item close sidebar if is open
1 parent ad1da8f commit 08adfca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/BottomNav.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { IoIosTime, IoIosAddCircle, IoIosSend } from "react-icons/io";
44
import { useLocation, useNavigate } from 'react-router-dom';
55
import { useTranslation } from 'react-i18next';
66

7-
const BottomNav = () => {
7+
const BottomNav = ({ isOpen, toggle }) => {
88
const location = useLocation();
99
const navigate = useNavigate();
1010
const { t } = useTranslation();
@@ -19,6 +19,9 @@ const BottomNav = () => {
1919
const handleNavigate = (path) => {
2020
if (location.pathname !== path) {
2121
navigate(path);
22+
if (isOpen) {
23+
toggle();
24+
}
2225
}
2326
};
2427

src/components/Layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const Layout = ({ children, isPermissionGranted, tokenSentInSession }) => {
138138
</div>
139139

140140
{/* Bottom Nav menu */}
141-
<BottomNav />
141+
<BottomNav isOpen={isOpen} toggle={toggleSidebar} />
142142
</div>
143143
);
144144
};

0 commit comments

Comments
 (0)