package dev.inmo.jsuikit.elements import androidx.compose.runtime.Composable import dev.inmo.jsuikit.modifiers.UIKitBreadcrumb import dev.inmo.jsuikit.modifiers.include import dev.inmo.jsuikit.utils.Attrs import org.jetbrains.compose.web.dom.* import org.w3c.dom.* @Composable fun Breadcrumb( data: Iterable, rootAttrs: Attrs = Attrs.empty(), elementAttrs: Attrs = Attrs.empty(), elementContent: @Composable ElementScope.(T) -> Unit = {}, ) { Ul( { include(UIKitBreadcrumb) rootAttrs.builder(this) } ) { data.forEach { Li({ elementAttrs.builder(this) }) { elementContent(it) } } } } @Composable fun BreadcrumbActiveElement( href: String? = "#", elementAttrs: Attrs = Attrs.empty(), elementContent: @Composable ElementScope.() -> Unit = {}, ) { A(href, { elementAttrs.builder(this) }) { elementContent() } } @Composable fun BreadcrumbInactiveElement( elementAttrs: Attrs = Attrs.empty(), elementContent: @Composable ElementScope.() -> Unit = {}, ) { Span({ elementAttrs.builder(this) }) { elementContent() } }