Logout Button Fix immer noch zu weit rechts gewesen
This commit is contained in:
@@ -1,25 +1,23 @@
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { Link } from 'react-router-dom'; // ← das hat gefehlt
|
||||||
import '../css/navbar.css';
|
import '../css/navbar.css';
|
||||||
import LightDarkToggle from './LightDarkToggle';
|
import LightDarkToggle from './LightDarkToggle';
|
||||||
import LogoutButton from './LogoutButton';
|
import LogoutButton from './LogoutButton';
|
||||||
|
|
||||||
function NavBar() {
|
function NavBar() {
|
||||||
const navigate = useNavigate();
|
|
||||||
const isLoggedIn = localStorage.getItem('token') !== null;
|
const isLoggedIn = localStorage.getItem('token') !== null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="navbar">
|
<nav className="navbar">
|
||||||
<div className="navbar-left">
|
<div className="nav-left">
|
||||||
<button onClick={() => navigate('/')}>🏠 Home</button>
|
<Link to="/" className="nav-button">🏠 Home</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="navbar-right">
|
|
||||||
{isLoggedIn && (
|
{isLoggedIn && (
|
||||||
<>
|
<div className="nav-right">
|
||||||
<LightDarkToggle />
|
<LightDarkToggle />
|
||||||
<LogoutButton />
|
<LogoutButton />
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-10
@@ -1,21 +1,24 @@
|
|||||||
.navbar {
|
.navbar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-color);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
left: 0;
|
||||||
|
right: 0;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
background-color: var(--navbar-bg);
|
z-index: 999;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 0 20px; /* vorher evtl. nur 10px oder weniger */
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-left,
|
/* Wenn du Elemente gruppieren willst */
|
||||||
.navbar-right {
|
.nav-left,
|
||||||
|
.nav-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar a,
|
.navbar a,
|
||||||
|
|||||||
Reference in New Issue
Block a user