2020-08-13 19:39:41 +02:00

30 lines
1.1 KiB
Kotlin

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 {
if (jwtPayload != null) {
li("inline text-gray-100 ml-2 text-md font-semibold") {
a(href = "/notes") { +"Notes" }
}
li(
"text-gray-800 bg-green-500 hover:bg-green-700" +
" inline ml-2 text-md font-semibold rounded px-4 py-2"
) {
form(classes = "inline", action = "/logout", method = FormMethod.post) {
button(type = ButtonType.submit) { +"Logout" }
}
}
} else {
li("inline text-gray-100 pl-2 text-md font-semibold") {
a(href = "/login") { +"Sign In" }
}
}
}
}
}