💄 Fixed the position of the appbars, and fixed some minor UI bugs
Signed-off-by: Pau Costa <mico@micodev.es>main
parent
a5e6a9505b
commit
6fbfe81918
|
|
@ -1,14 +1,19 @@
|
||||||
import { BottomNavigation, BottomNavigationAction, Paper } from "@mui/material";
|
import { BottomNavigation, BottomNavigationAction, Paper } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import FeedIcon from "@mui/icons-material/Feed";
|
import FeedIcon from "@mui/icons-material/Feed";
|
||||||
import GlobalIcon from "@mui/icons-material/Public";
|
import GlobalIcon from "@mui/icons-material/Public";
|
||||||
import AddIcon from "@mui/icons-material/Add";
|
import AddIcon from "@mui/icons-material/Add";
|
||||||
import SearchIcon from "@mui/icons-material/Search";
|
import SearchIcon from "@mui/icons-material/Search";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export default function BottomAppBar() {
|
export default function BottomAppBar() {
|
||||||
const [value, setValue] = useState(0);
|
const [value, setValue] = useState("");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setValue(location.pathname.replace("/", ""));
|
||||||
|
}, [location]);
|
||||||
|
|
||||||
const handleClick = (to: string) => () => {
|
const handleClick = (to: string) => () => {
|
||||||
navigate(to);
|
navigate(to);
|
||||||
|
|
@ -27,21 +32,25 @@ export default function BottomAppBar() {
|
||||||
>
|
>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="My Feed"
|
label="My Feed"
|
||||||
|
value="feed"
|
||||||
icon={<FeedIcon />}
|
icon={<FeedIcon />}
|
||||||
onClick={handleClick("feed")}
|
onClick={handleClick("feed")}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Global Feed"
|
label="Global Feed"
|
||||||
|
value="global"
|
||||||
icon={<GlobalIcon />}
|
icon={<GlobalIcon />}
|
||||||
onClick={handleClick("global")}
|
onClick={handleClick("global")}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="New Post"
|
label="New Post"
|
||||||
|
value="newpost"
|
||||||
icon={<AddIcon />}
|
icon={<AddIcon />}
|
||||||
onClick={handleClick("newpost")}
|
onClick={handleClick("newpost")}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Search"
|
label="Search"
|
||||||
|
value="search"
|
||||||
icon={<SearchIcon />}
|
icon={<SearchIcon />}
|
||||||
onClick={handleClick("search")}
|
onClick={handleClick("search")}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ function TopAppBar(props: TopAppBarProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar
|
<AppBar
|
||||||
position="absolute"
|
position="fixed"
|
||||||
sx={{ zIndex: 1600, height: `${props.height}px` }}
|
sx={{ zIndex: 1600, height: `${props.height}px` }}
|
||||||
>
|
>
|
||||||
<Toolbar disableGutters>
|
<Toolbar disableGutters>
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export default function Search() {
|
||||||
<Paper>
|
<Paper>
|
||||||
<List>
|
<List>
|
||||||
{displayUserList.map((user) => (
|
{displayUserList.map((user) => (
|
||||||
<>
|
<Box key={user.id}>
|
||||||
<ListItem key={user.id}>
|
<ListItem key={user.id}>
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|
@ -78,7 +78,7 @@ export default function Search() {
|
||||||
</Button>
|
</Button>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider sx={{ mb: "0.3rem" }} />
|
<Divider sx={{ mb: "0.3rem" }} />
|
||||||
</>
|
</Box>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue