mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-23 02:28:47 +00:00
support of breadcrumb
This commit is contained in:
parent
d5045bdba7
commit
e6b0ca580a
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## 0.0.48
|
## 0.0.48
|
||||||
|
|
||||||
|
* Added support of `Breadcrumb`
|
||||||
|
|
||||||
## 0.0.47
|
## 0.0.47
|
||||||
|
|
||||||
* Add support of `Close` element
|
* Add support of `Close` element
|
||||||
|
50
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Breadcrumb.kt
Normal file
50
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Breadcrumb.kt
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
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 <T> Breadcrumb(
|
||||||
|
data: Iterable<T>,
|
||||||
|
rootAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
|
||||||
|
elementAttrs: Attrs<HTMLLIElement> = Attrs.empty(),
|
||||||
|
elementContent: @Composable ElementScope<HTMLLIElement>.(T) -> Unit = {},
|
||||||
|
) {
|
||||||
|
Ul(
|
||||||
|
{
|
||||||
|
include(UIKitBreadcrumb)
|
||||||
|
rootAttrs.builder(this)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
data.forEach {
|
||||||
|
Li({ elementAttrs.builder(this) }) {
|
||||||
|
elementContent(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BreadcrumbActiveElement(
|
||||||
|
href: String? = "#",
|
||||||
|
elementAttrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
|
||||||
|
elementContent: @Composable ElementScope<HTMLAnchorElement>.() -> Unit = {},
|
||||||
|
) {
|
||||||
|
A(href, { elementAttrs.builder(this) }) {
|
||||||
|
elementContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BreadcrumbInactiveElement(
|
||||||
|
elementAttrs: Attrs<HTMLSpanElement> = Attrs.empty(),
|
||||||
|
elementContent: @Composable ElementScope<HTMLSpanElement>.() -> Unit = {},
|
||||||
|
) {
|
||||||
|
Span({ elementAttrs.builder(this) }) {
|
||||||
|
elementContent()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package dev.inmo.jsuikit.modifiers
|
||||||
|
|
||||||
|
sealed class UIKitBreadcrumb(
|
||||||
|
override val classes: Array<String> = emptyArray(),
|
||||||
|
override val otherAttrs: Map<String, String> = emptyMap()
|
||||||
|
) : UIKitModifier {
|
||||||
|
companion object : UIKitBreadcrumb(arrayOf("uk-breadcrumb"))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user