Check if the user is already logged in and do not show all options (fix #122)

This commit is contained in:
cami 2021-07-11 00:04:00 +02:00
parent a41b9c2892
commit 4391cf790c

View file

@ -3,28 +3,37 @@ import "../App.css";
import { Button } from "./Button"; import { Button } from "./Button";
import "./HeroSection.css"; import "./HeroSection.css";
import "@fortawesome/fontawesome-free/css/all.css"; import "@fortawesome/fontawesome-free/css/all.css";
import { useAuth } from "../auth/AuthProvider";
function HeroSection() { function HeroSection() {
const [isLoggedIn] = useAuth();
return ( return (
<div className="hero-container"> <div className="hero-container">
<h1>Herzlich Willkommen</h1> <h1>Herzlich Willkommen</h1>
<div className="hero-btns"> <div className="hero-btns">
<Button {isLoggedIn ? (
className="btns" console.log("Logged in")
buttonStyle="btn--primary" ) : (
buttonSize="btn--large" <>
newTo="login" <Button
> className="btns"
Einloggen (wenn du schon einmal mitgemacht hast) buttonStyle="btn--primary"
</Button> buttonSize="btn--large"
<Button newTo="login"
className="btns" >
buttonStyle="btn--primary" Einloggen (wenn du schon einmal mitgemacht hast)
buttonSize="btn--large" </Button>
newTo="register" <Button
> className="btns"
Registrieren (falls du das erste Mal hier bist) buttonStyle="btn--primary"
</Button> buttonSize="btn--large"
newTo="register"
>
Registrieren (falls du das erste Mal hier bist)
</Button>
</>
)}
<Button <Button
className="btns" className="btns"
buttonStyle="btn--primary" buttonStyle="btn--primary"