mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
change header height, change header icon margin for mobile
This commit is contained in:
parent
23dd7c6d9d
commit
e29df7a294
1 changed files with 142 additions and 83 deletions
|
@ -1,17 +1,23 @@
|
|||
import "./header.css";
|
||||
import React, { useState, useRef } from "react";
|
||||
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, StyledEngineProvider, SwipeableDrawer, ThemeProvider } from '@mui/material';
|
||||
import Box from '@mui/material/Box';
|
||||
import AddAPhotoIcon from '@mui/icons-material/AddAPhoto';
|
||||
import DynamicFeedIcon from '@mui/icons-material/DynamicFeed';
|
||||
import PersonIcon from '@mui/icons-material/Person';
|
||||
import InfoIcon from '@mui/icons-material/Info';
|
||||
import LogoutIcon from '@mui/icons-material/Logout';
|
||||
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
|
||||
import FollowTheSignsIcon from '@mui/icons-material/FollowTheSigns';
|
||||
import React, { useState } from "react";
|
||||
import {
|
||||
List,
|
||||
ListItem,
|
||||
ListItemButton,
|
||||
ListItemIcon,
|
||||
ListItemText,
|
||||
SwipeableDrawer,
|
||||
} from "@mui/material";
|
||||
import Box from "@mui/material/Box";
|
||||
import AddAPhotoIcon from "@mui/icons-material/AddAPhoto";
|
||||
import DynamicFeedIcon from "@mui/icons-material/DynamicFeed";
|
||||
import PersonIcon from "@mui/icons-material/Person";
|
||||
import InfoIcon from "@mui/icons-material/Info";
|
||||
import LogoutIcon from "@mui/icons-material/Logout";
|
||||
import ExitToAppIcon from "@mui/icons-material/ExitToApp";
|
||||
import FollowTheSignsIcon from "@mui/icons-material/FollowTheSigns";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useAuth } from "../api/Auth";
|
||||
import { ExitToApp } from "@mui/icons-material";
|
||||
|
||||
function Header() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
@ -19,17 +25,34 @@ function Header() {
|
|||
setIsOpen(!isOpen);
|
||||
};
|
||||
const { logout, user } = useAuth();
|
||||
const iconList = [DynamicFeedIcon, AddAPhotoIcon, PersonIcon, InfoIcon, LogoutIcon, ExitToAppIcon, FollowTheSignsIcon];
|
||||
const routerLinksList = ["/feed","/createpost","/profile","/about","/login","/register"]
|
||||
|
||||
// TODO: Logout nur anzeigen wenn user eingeloggt ist
|
||||
const iconList = [
|
||||
DynamicFeedIcon,
|
||||
AddAPhotoIcon,
|
||||
PersonIcon,
|
||||
InfoIcon,
|
||||
LogoutIcon,
|
||||
ExitToAppIcon,
|
||||
FollowTheSignsIcon,
|
||||
];
|
||||
const routerLinksList = [
|
||||
"/feed",
|
||||
"/createpost",
|
||||
"/profile",
|
||||
"/about",
|
||||
"/login",
|
||||
"/register",
|
||||
];
|
||||
|
||||
const DrawerList = (
|
||||
<Box role="menu" onClick={() => setIsOpen(false)}>
|
||||
<List className="drawer-list">
|
||||
{["Feed", "Create Post", "Profile", "About Us"].map((text, index) => (
|
||||
<ListItem className="drawer-list-item" key={text} disablePadding>
|
||||
<ListItemButton className="drawer-list-item-button" component={Link} to={routerLinksList[index]} >
|
||||
<ListItemButton
|
||||
className="drawer-list-item-button"
|
||||
component={Link}
|
||||
to={routerLinksList[index]}
|
||||
>
|
||||
<ListItemIcon className="drawer-list-item">
|
||||
{React.createElement(iconList[index])}
|
||||
</ListItemIcon>
|
||||
|
@ -37,31 +60,62 @@ function Header() {
|
|||
</ListItemButton>
|
||||
</ListItem>
|
||||
))}
|
||||
{user && <ListItem className="drawer-list-item-button" key={"Log Out"} disablePadding>
|
||||
<ListItemButton className="drawer-list-item-button" onClick={logout}>
|
||||
{user && (
|
||||
<ListItem
|
||||
className="drawer-list-item-button"
|
||||
key={"Log Out"}
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
className="drawer-list-item-button"
|
||||
onClick={logout}
|
||||
>
|
||||
<ListItemIcon className="drawer-list-item">
|
||||
{React.createElement(iconList[4])}
|
||||
</ListItemIcon>
|
||||
<ListItemText className="drawer-list-item" primary={"Log Out"} />
|
||||
</ListItemButton>
|
||||
</ListItem> }
|
||||
{!user && <> <ListItem className="drawer-list-item-button" key={"Login"} disablePadding>
|
||||
<ListItemButton className="drawer-list-item-button" component={Link} to={routerLinksList[4]}>
|
||||
</ListItem>
|
||||
)}
|
||||
{!user && (
|
||||
<>
|
||||
<ListItem
|
||||
className="drawer-list-item-button"
|
||||
key={"Login"}
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
className="drawer-list-item-button"
|
||||
component={Link}
|
||||
to={routerLinksList[4]}
|
||||
>
|
||||
<ListItemIcon className="drawer-list-item">
|
||||
{React.createElement(iconList[5])}
|
||||
</ListItemIcon>
|
||||
<ListItemText className="drawer-list-item" primary={"Login"} />
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
<ListItem className="drawer-list-item-button" key={"Sign up"} disablePadding>
|
||||
<ListItemButton className="drawer-list-item-button" component={Link} to={routerLinksList[5]}>
|
||||
<ListItem
|
||||
className="drawer-list-item-button"
|
||||
key={"Sign up"}
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
className="drawer-list-item-button"
|
||||
component={Link}
|
||||
to={routerLinksList[5]}
|
||||
>
|
||||
<ListItemIcon className="drawer-list-item">
|
||||
{React.createElement(iconList[6])}
|
||||
</ListItemIcon>
|
||||
<ListItemText className="drawer-list-item" primary={"Sign up"}/>
|
||||
<ListItemText
|
||||
className="drawer-list-item"
|
||||
primary={"Sign up"}
|
||||
/>
|
||||
</ListItemButton>
|
||||
</ListItem> </> }
|
||||
|
||||
</ListItem>{" "}
|
||||
</>
|
||||
)}
|
||||
</List>
|
||||
</Box>
|
||||
);
|
||||
|
@ -69,11 +123,18 @@ function Header() {
|
|||
return (
|
||||
<>
|
||||
<header className="base-header blue-background">
|
||||
<div className="header-icon"> <img className="header-icon-feather" src='/assets/icons/BirdIconO.ico' alt="featherIcon" /> </div>
|
||||
<p className="header-title small-title">
|
||||
Feather Feed
|
||||
</p>
|
||||
<div className="header-icon header-icon-menu"> <img src='/assets/icons/menu_orange.svg' alt="menu" onClick={toggleMenu} /> </div>
|
||||
<img
|
||||
className="header-icon header-icon-feather"
|
||||
src="/assets/icons/BirdIconO.ico"
|
||||
alt="featherIcon"
|
||||
/>
|
||||
<p className="header-title small-title">Feather Feed</p>
|
||||
<img
|
||||
className="header-icon header-icon-menu"
|
||||
src="/assets/icons/menu_orange.svg"
|
||||
alt="menu"
|
||||
onClick={toggleMenu}
|
||||
/>
|
||||
</header>
|
||||
<SwipeableDrawer
|
||||
anchor={"right"}
|
||||
|
@ -87,7 +148,5 @@ function Header() {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// EXPORT VARIABLES
|
||||
export default Header;
|
Loading…
Add table
Add a link
Reference in a new issue