Back

Version 54

5/22/2024
/** @jsxImportSource https://esm.sh/hono@latest/jsx */
import { jsx, Fragment } from 'https://deno.land/x/hono/middleware.ts';

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>
) : (
// Otherwise render login and create profile buttons
<>
<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
onClick="closeModal()"
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"
>
Updated: May 22, 2024