mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-29 01:28:59 -05:00
Fix NavBar on mobile
This commit is contained in:
parent
c28d3f960e
commit
464406603a
1 changed files with 15 additions and 4 deletions
|
@ -11,7 +11,7 @@ import {
|
|||
import { useBooleanToggle } from "@mantine/hooks";
|
||||
import { NextLink } from "@mantine/next";
|
||||
import Image from "next/image";
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import React, { ReactNode, useContext, useEffect, useState } from "react";
|
||||
import headerStyle from "../../styles/header.style";
|
||||
import { IsSignedInContext } from "../../utils/auth.util";
|
||||
import { useConfig } from "../../utils/config.util";
|
||||
|
@ -19,7 +19,8 @@ import ActionAvatar from "./ActionAvatar";
|
|||
|
||||
type Link = {
|
||||
link?: string;
|
||||
label: string;
|
||||
label?: string;
|
||||
component?: ReactNode;
|
||||
action?: () => Promise<void>;
|
||||
};
|
||||
|
||||
|
@ -35,6 +36,9 @@ const Header = () => {
|
|||
link: "/upload",
|
||||
label: "Upload",
|
||||
},
|
||||
{
|
||||
component: <ActionAvatar />,
|
||||
},
|
||||
];
|
||||
|
||||
const unauthenticatedLinks: Link[] | undefined = [
|
||||
|
@ -59,6 +63,15 @@ const Header = () => {
|
|||
const links = isSignedIn ? authenticatedLinks : unauthenticatedLinks;
|
||||
|
||||
const items = links.map((link) => {
|
||||
if (link.component) {
|
||||
return (
|
||||
<>
|
||||
<Container pl={5} py={15}>
|
||||
{link.component}
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (link) {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useEffect(() => {
|
||||
|
@ -97,8 +110,6 @@ const Header = () => {
|
|||
</NextLink>
|
||||
<Group spacing={5} className={classes.links}>
|
||||
{items}
|
||||
<Space w={5} />
|
||||
{isSignedIn && <ActionAvatar />}
|
||||
</Group>
|
||||
<Burger
|
||||
opened={opened}
|
||||
|
|
Loading…
Add table
Reference in a new issue