mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-16 13:23:58 +00:00
23 lines
586 B
Kotlin
23 lines
586 B
Kotlin
package dev.inmo.jsuikit.utils
|
|
|
|
import androidx.compose.runtime.Composable
|
|
import org.jetbrains.compose.web.dom.ContentBuilder
|
|
import org.w3c.dom.Element
|
|
|
|
@Composable
|
|
inline fun optionallyDraw (
|
|
vararg bools: Boolean,
|
|
whatToDraw: @Composable () -> Unit
|
|
) {
|
|
if (bools.any { it }) {
|
|
whatToDraw()
|
|
}
|
|
}
|
|
|
|
@Composable
|
|
inline fun <T : Element> optionallyDraw (
|
|
attrs: Attrs<T>? = null,
|
|
noinline contentBuilder: ContentBuilder<T>? = null,
|
|
whatToDraw: @Composable () -> Unit
|
|
) = optionallyDraw(attrs != null || contentBuilder != null, whatToDraw = whatToDraw)
|