diff --git a/client/src/components/bottomAppBar.tsx b/client/src/components/bottomAppBar.tsx
index a94ff78..887039c 100644
--- a/client/src/components/bottomAppBar.tsx
+++ b/client/src/components/bottomAppBar.tsx
@@ -1,14 +1,19 @@
import { BottomNavigation, BottomNavigationAction, Paper } from "@mui/material";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import FeedIcon from "@mui/icons-material/Feed";
import GlobalIcon from "@mui/icons-material/Public";
import AddIcon from "@mui/icons-material/Add";
import SearchIcon from "@mui/icons-material/Search";
-import { useNavigate } from "react-router-dom";
+import { useLocation, useNavigate } from "react-router-dom";
export default function BottomAppBar() {
- const [value, setValue] = useState(0);
+ const [value, setValue] = useState("");
const navigate = useNavigate();
+ const location = useLocation();
+
+ useEffect(() => {
+ setValue(location.pathname.replace("/", ""));
+ }, [location]);
const handleClick = (to: string) => () => {
navigate(to);
@@ -27,21 +32,25 @@ export default function BottomAppBar() {
>
}
onClick={handleClick("feed")}
/>
}
onClick={handleClick("global")}
/>
}
onClick={handleClick("newpost")}
/>
}
onClick={handleClick("search")}
/>
diff --git a/client/src/components/topAppBar.tsx b/client/src/components/topAppBar.tsx
index 75dbdfd..182d6b2 100644
--- a/client/src/components/topAppBar.tsx
+++ b/client/src/components/topAppBar.tsx
@@ -51,7 +51,7 @@ function TopAppBar(props: TopAppBarProps) {
return (
diff --git a/client/src/routes/search.tsx b/client/src/routes/search.tsx
index 3fa088d..c7d4799 100644
--- a/client/src/routes/search.tsx
+++ b/client/src/routes/search.tsx
@@ -62,7 +62,7 @@ export default function Search() {
{displayUserList.map((user) => (
- <>
+
- >
+
))}