Reuben Firmin
11/29/2023, 12:01 PMReuben Firmin
11/29/2023, 12:02 PMclass Sidebar(consumer: TagConsumer<*>): ASIDE(mapOf(
"class" to "absolute top-30 left-0 z-40 w-64 h-screen transition-transform -translate-x-full sm:translate-x-0",
// XXX this doesn't set it
// "aria-label" to "Sidebar",
"id" to "default-sidebar"), consumer) {
fun render(block: Sidebar.() -> Unit) {
// XXX this breaks with exception
attributes["aria-label"] = "Sidebar"
// id = "default-sidebar"
div("h-full px-3 py-4 overflow-y-auto bg-gray-50 dark:bg-gray-800") {
this@Sidebar.block()
}
}
}
fun FlowContent.sidebar(block: Sidebar.() -> Unit) {
Sidebar(consumer).render(block)
}
Reuben Firmin
11/29/2023, 12:02 PMReuben Firmin
11/29/2023, 12:04 PMfun FlowContent.sidebar(block: Sidebar.() -> Unit) {
Sidebar(consumer)
.visit { render(block) }
}