package be.simplenotes.app.views.components import be.simplenotes.domain.security.JwtPayload import kotlinx.html.* fun BODY.navbar(jwtPayload: JwtPayload?) { nav("nav bg-teal-700 shadow-md flex items-center justify-between px-4") { a(href = "/", classes = "text-2xl text-gray-100 font-bold") { +"SimpleNotes" } ul("space-x-2") { if (jwtPayload != null) { val links = listOf( "/notes" to "Notes", "/settings" to "Settings", ) links.forEach { (href, name) -> li("inline text-gray-100 text-md font-semibold") { a(href = href) { +name } } } li("inline") { form(classes = "inline", action = "/logout", method = FormMethod.post) { button(type = ButtonType.submit, classes = "btn btn-green") { +"Logout" } } } } else { li("inline") { a(href = "/login", classes = "btn btn-green") { +"Sign In" } } } } } }