Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/** @jsxImportSource https://esm.sh/hono@latest/jsx */
export default function Nav({ currentPath }) {
const isEditProfilePath = currentPath && currentPath.startsWith('/edit-profile/');
return (
<nav className="flex flex-row justify-between items-center">
<a className="" href="/"><h2 style={{ fontFamily: '"Jaro", sans-serif' }} className="text-4xl text-neutral-800">/now</h2></a>
<div className="flex flex-row gap-2 mt-1">
{isEditProfilePath ? (
<button
hx-post="/logout"
hx-target="body"
className="text-sm px-2 py-1 bg-yellow-100 border-2 border-yellow-700 rounded-md font-bold text-yellow-900 uppercase tracking-wider hover:bg-yellow-200"
>
logout
</button>
) : (
<>
<button
hx-get="/loginModal"
hx-target="body"
hx-swap="afterbegin"
className="text-sm px-2 py-1 bg-yellow-100 border-2 border-yellow-700 rounded-md font-bold text-yellow-900 uppercase tracking-wider hover:bg-yellow-200"
>
login
</button>
<button
hx-get="/signupModal"
hx-target="body"
hx-swap="afterbegin"
className="text-sm px-2 py-1 bg-yellow-100 border-2 border-yellow-700 rounded-md font-bold text-yellow-900 uppercase tracking-wider hover:bg-yellow-200"
>
create page
</button>
</>
)}
</div>
</nav>
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
May 22, 2024