2022-01-12 10:27:49 +00:00
|
|
|
package dev.inmo.jsuikit.elements
|
2021-12-22 08:38:12 +00:00
|
|
|
|
|
|
|
import androidx.compose.runtime.Composable
|
2022-01-12 13:58:52 +00:00
|
|
|
import dev.inmo.jsuikit.modifiers.UIKitModifier
|
|
|
|
import dev.inmo.jsuikit.modifiers.include
|
2022-01-13 05:55:08 +00:00
|
|
|
import org.jetbrains.compose.web.dom.*
|
2021-12-22 08:38:12 +00:00
|
|
|
import org.w3c.dom.HTMLDivElement
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun GridColumn(
|
2022-01-13 05:55:08 +00:00
|
|
|
modifiers: Array<UIKitModifier> = emptyArray(),
|
|
|
|
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
2021-12-22 08:38:12 +00:00
|
|
|
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit
|
|
|
|
) {
|
|
|
|
Div(
|
|
|
|
{
|
|
|
|
include(*modifiers)
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer()
|
2021-12-22 08:38:12 +00:00
|
|
|
}
|
|
|
|
) {
|
|
|
|
builder()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun Grid(
|
2022-01-13 05:55:08 +00:00
|
|
|
modifiers: Array<UIKitModifier> = emptyArray(),
|
2021-12-22 08:38:12 +00:00
|
|
|
masonry: Boolean = false,
|
|
|
|
parallax: Int? = null,
|
|
|
|
marginClass: String? = null,
|
|
|
|
firstColumnClass: String? = null,
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
2021-12-22 08:38:12 +00:00
|
|
|
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit
|
|
|
|
) {
|
|
|
|
val attrs = listOfNotNull(
|
|
|
|
if (masonry) "masonry" to "true" else null,
|
|
|
|
parallax ?.let { "parallax" to it.toString() },
|
|
|
|
marginClass ?.let { "margin" to it },
|
|
|
|
firstColumnClass ?.let { "first-column" to it },
|
|
|
|
)
|
|
|
|
Div(
|
|
|
|
{
|
|
|
|
attr("uk-grid", attrs.joinToString(";") { (k, v) -> "$k: $v" })
|
|
|
|
classes("uk-grid")
|
|
|
|
include(*modifiers)
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer()
|
2021-12-22 08:38:12 +00:00
|
|
|
}
|
|
|
|
) {
|
|
|
|
builder()
|
|
|
|
}
|
|
|
|
}
|