add container support

This commit is contained in:
InsanusMokrassar 2022-03-16 16:03:35 +06:00
parent c59c442a36
commit 1f44f27fbb
3 changed files with 42 additions and 0 deletions

View File

@ -2,6 +2,8 @@
## 0.0.45 ## 0.0.45
* `Add support of containers in `UIKitContainer` modifiers and `Container` function
## 0.0.44 ## 0.0.44
* `Versions`: * `Versions`:

View 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
)

View File

@ -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")
)
}