mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-12-05 17:30:50 +00:00
refactor: Set default colorScheme to purple
Took 1 hour 12 minutes
This commit is contained in:
+53
-67
@@ -6,87 +6,73 @@ import {
|
||||
Button,
|
||||
Image,
|
||||
Link,
|
||||
} from "@chakra-ui/react";
|
||||
import { useRouter } from "next/router";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
} from '@chakra-ui/react';
|
||||
import {useRouter} from 'next/router';
|
||||
import {signOut, useSession} from 'next-auth/react';
|
||||
|
||||
type Props = {
|
||||
variant: "static" | "fixed";
|
||||
variant: 'static' | 'fixed';
|
||||
};
|
||||
|
||||
export default function Navbar({ variant = "fixed" }: Props) {
|
||||
export default function Navbar({variant = 'fixed'}: Props) {
|
||||
const router = useRouter();
|
||||
const { data: session, status } = useSession();
|
||||
const {data: session, status} = useSession();
|
||||
|
||||
const MiddleSection = () => {
|
||||
const authenticatedLinks = (
|
||||
<>
|
||||
<Link href={'/dashboard'}>Tableau de bord</Link>
|
||||
<Link href={'/profile'}>Profile</Link>
|
||||
<Link href={'/map'}>Carte</Link>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<Flex gap={5} justify={'center'} flexBasis={'100%'}>
|
||||
{status === 'authenticated'
|
||||
? authenticatedLinks
|
||||
: <></>
|
||||
}
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
const RightSection = () => {
|
||||
if (status === "authenticated" && session.user)
|
||||
return (
|
||||
<Flex justify={"right"} flexBasis={"100%"}>
|
||||
|
||||
const authenticatedButtons = (
|
||||
<Button onClick={() => signOut()}>Déconnexion</Button>
|
||||
);
|
||||
|
||||
const unauthenticatedButtons = (
|
||||
<>
|
||||
<Button onClick={() => router.push('/register')}>Inscription</Button>
|
||||
<Button onClick={() => router.push('/login')}>Connexion</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<Flex justify={'right'} flexBasis={'100%'}>
|
||||
<ButtonGroup>
|
||||
<Button colorScheme={"purple"} onClick={() => signOut()}>
|
||||
Déconnexion
|
||||
</Button>
|
||||
{status === 'authenticated'
|
||||
? authenticatedButtons
|
||||
: unauthenticatedButtons
|
||||
}
|
||||
</ButtonGroup>
|
||||
</Flex>
|
||||
);
|
||||
else
|
||||
return (
|
||||
<Flex justify={"right"} flexBasis={"100%"}>
|
||||
<ButtonGroup>
|
||||
<Button onClick={() => router.push("/register")}>
|
||||
Inscription
|
||||
</Button>
|
||||
<Button
|
||||
colorScheme={"purple"}
|
||||
onClick={() => router.push("/login")}
|
||||
>
|
||||
Connexion
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Flex>
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box
|
||||
position={variant}
|
||||
zIndex={9999}
|
||||
top={0}
|
||||
width={"100vw"}
|
||||
backdropFilter={"auto"}
|
||||
backdropBlur={"20px"}
|
||||
px={10}
|
||||
py={2}
|
||||
>
|
||||
<Flex align={"center"}>
|
||||
<Box flexBasis={"100%"}>
|
||||
<Image src={"/logo.svg"} h={"3rem"} objectFit={"contain"} />
|
||||
</Box>
|
||||
<Box position={variant} zIndex={9999} top={0} width={'100vw'}
|
||||
backdropFilter={'auto'} backdropBlur={'20px'} px={10} py={2}>
|
||||
<Flex align={'center'}>
|
||||
<Box flexBasis={'100%'}>
|
||||
<Image src={'/logo.svg'} h={'3rem'} objectFit={'contain'}/>
|
||||
</Box>
|
||||
|
||||
<Flex gap={5} justify={"center"} flexBasis={"100%"}>
|
||||
{status === "authenticated" ? (
|
||||
<>
|
||||
<Link href={"/dashboard"} color={"purple.500"}>
|
||||
Tableau de bord
|
||||
</Link>
|
||||
<Link href={"/profile"} color={"purple.500"}>
|
||||
Profile
|
||||
</Link>
|
||||
<Link href={"/map"} color={"purple.500"}>
|
||||
Carte
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Text>A propos</Text>
|
||||
<Text>Contact</Text>
|
||||
<Text>Aide</Text>
|
||||
</>
|
||||
)}
|
||||
<MiddleSection/>
|
||||
<RightSection/>
|
||||
</Flex>
|
||||
|
||||
<RightSection />
|
||||
</Flex>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user