user action in header
This commit is contained in:
parent
acd020ed3b
commit
f6346f8165
4 changed files with 44 additions and 12 deletions
|
|
@ -1,5 +1,8 @@
|
|||
---
|
||||
import UserAction from "../islands/UserAction";
|
||||
import Logo from "./Logo.astro";
|
||||
|
||||
|
||||
---
|
||||
|
||||
<header>
|
||||
|
|
@ -11,8 +14,9 @@ import Logo from "./Logo.astro";
|
|||
<a href="/">Startseite</a>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
<a href="/impressum" style="#789">Impressum</a>
|
||||
<a href="/privacy-policy" style="#789">Datenschutz</a>
|
||||
<UserAction client:only/>
|
||||
<a href="/impressum" class="menu-nav">Impressum</a>
|
||||
<a href="/privacy-policy" class="menu-nav">Datenschutz</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
|
@ -53,11 +57,6 @@ import Logo from "./Logo.astro";
|
|||
gap: 16px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--primary-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#menu-toggle,
|
||||
.menu-icon,
|
||||
.menu-backdrop,
|
||||
|
|
|
|||
20
blog/src/islands/UserAction.tsx
Normal file
20
blog/src/islands/UserAction.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export default function LoginForm() {
|
||||
let text = "⚓︎ Login"
|
||||
let link = "/login"
|
||||
|
||||
const username = localStorage.getItem("username")
|
||||
|
||||
if (username) {
|
||||
text = `⚓︎ ${username}`
|
||||
link = "/user"
|
||||
}
|
||||
|
||||
return (
|
||||
<a
|
||||
href={link}
|
||||
class="menu-nav"
|
||||
style="font-weight: bolder;">
|
||||
{text}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
8
blog/src/pages/login.astro
Normal file
8
blog/src/pages/login.astro
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
import Main from "../layouts/Main.astro";
|
||||
---
|
||||
|
||||
<Main>
|
||||
|
||||
|
||||
</Main>
|
||||
|
|
@ -34,6 +34,11 @@ body {
|
|||
color: black;
|
||||
}
|
||||
|
||||
.menu-nav {
|
||||
color: var(--primary-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
|
@ -77,4 +82,4 @@ body {
|
|||
max-height: 500px;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue