package be.simplenotes.app.views.components import be.simplenotes.domain.security.JwtPayload import kotlinx.html.* fun BODY.navbar(jwtPayload: JwtPayload?) { nav { id = "navbar" a("/") { id = "home" +"SimpleNotes" } ul("space-x-2") { id = "navigation" if (jwtPayload != null) { val links = listOf( "/notes" to "Notes", "/settings" to "Settings", ) links.forEach { (href, name) -> li("txt") { a(href = href) { +name } } } li { form(action = "/logout", method = FormMethod.post) { button(type = ButtonType.submit, classes = "btn btn-green") { +"Logout" } } } } else { li { a(href = "/login", classes = "btn btn-green") { +"Sign In" } } } } } }