mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-22 00:27:25 +00:00
add container support
This commit is contained in:
parent
c59c442a36
commit
1f44f27fbb
@ -2,6 +2,8 @@
|
||||
|
||||
## 0.0.45
|
||||
|
||||
* `Add support of containers in `UIKitContainer` modifiers and `Container` function
|
||||
|
||||
## 0.0.44
|
||||
|
||||
* `Versions`:
|
||||
|
21
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Container.kt
Normal file
21
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Container.kt
Normal file
@ -0,0 +1,21 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.inmo.jsuikit.modifiers.UIKitContainer
|
||||
import dev.inmo.jsuikit.modifiers.include
|
||||
import dev.inmo.jsuikit.utils.Attrs
|
||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Container(
|
||||
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
|
||||
contentBuilder: ContentBuilder<HTMLDivElement> = {}
|
||||
) = Div(
|
||||
{
|
||||
include(UIKitContainer)
|
||||
attrs.builder.invoke(this)
|
||||
},
|
||||
contentBuilder
|
||||
)
|
@ -0,0 +1,19 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitContainer(
|
||||
override val classes: Array<String> = emptyArray(),
|
||||
override val otherAttrs: Map<String, String> = emptyMap()
|
||||
) : UIKitModifier {
|
||||
|
||||
sealed class Size(size: String) : UIKitContainer(arrayOf("uk-container-$size")) {
|
||||
object XSmall : Size("xsmall")
|
||||
object Small : Size("small")
|
||||
object Large : Size("large")
|
||||
object XLarge : Size("xlarge")
|
||||
object Expand : Size("expand")
|
||||
}
|
||||
|
||||
companion object : UIKitContainer(
|
||||
arrayOf("uk-container")
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user