Check if the user is already logged in and do not show all options (fix #122)
This commit is contained in:
parent
a41b9c2892
commit
4391cf790c
1 changed files with 25 additions and 16 deletions
|
@ -3,28 +3,37 @@ import "../App.css";
|
|||
import { Button } from "./Button";
|
||||
import "./HeroSection.css";
|
||||
import "@fortawesome/fontawesome-free/css/all.css";
|
||||
import { useAuth } from "../auth/AuthProvider";
|
||||
|
||||
function HeroSection() {
|
||||
const [isLoggedIn] = useAuth();
|
||||
|
||||
return (
|
||||
<div className="hero-container">
|
||||
<h1>Herzlich Willkommen</h1>
|
||||
<div className="hero-btns">
|
||||
<Button
|
||||
className="btns"
|
||||
buttonStyle="btn--primary"
|
||||
buttonSize="btn--large"
|
||||
newTo="login"
|
||||
>
|
||||
Einloggen (wenn du schon einmal mitgemacht hast)
|
||||
</Button>
|
||||
<Button
|
||||
className="btns"
|
||||
buttonStyle="btn--primary"
|
||||
buttonSize="btn--large"
|
||||
newTo="register"
|
||||
>
|
||||
Registrieren (falls du das erste Mal hier bist)
|
||||
</Button>
|
||||
{isLoggedIn ? (
|
||||
console.log("Logged in")
|
||||
) : (
|
||||
<>
|
||||
<Button
|
||||
className="btns"
|
||||
buttonStyle="btn--primary"
|
||||
buttonSize="btn--large"
|
||||
newTo="login"
|
||||
>
|
||||
Einloggen (wenn du schon einmal mitgemacht hast)
|
||||
</Button>
|
||||
<Button
|
||||
className="btns"
|
||||
buttonStyle="btn--primary"
|
||||
buttonSize="btn--large"
|
||||
newTo="register"
|
||||
>
|
||||
Registrieren (falls du das erste Mal hier bist)
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
className="btns"
|
||||
buttonStyle="btn--primary"
|
||||
|
|
Loading…
Reference in a new issue