mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-29 21:48:46 +00:00
commit
6144ee5723
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.45
|
||||
|
||||
* `Add support of containers in `UIKitContainer` modifiers and `Container` function
|
||||
|
||||
## 0.0.44
|
||||
|
||||
* `Versions`:
|
||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.0.44
|
||||
version=0.0.45
|
||||
|
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