additions in UIKitScreenSizeModifier and support of Tile

This commit is contained in:
InsanusMokrassar 2022-03-12 00:06:47 +06:00
parent 475afeb78b
commit 3ddb22341c
4 changed files with 48 additions and 0 deletions

View File

@ -2,6 +2,9 @@
## 0.0.43 ## 0.0.43
* Several new extensions for `UIKitModifier` like `UIKitModifier#onSmallScreen`
* Support of `Tile`
## 0.0.42 ## 0.0.42
* Migration to compose 1.1.0 * Migration to compose 1.1.0

View File

@ -0,0 +1,21 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitTile
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 Tile(
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
contentBuilder: ContentBuilder<HTMLDivElement>
) = Div(
{
include(UIKitTile)
attrs.builder(this)
},
contentBuilder
)

View File

@ -20,3 +20,12 @@ sealed class UIKitScreenSizeModifier(val name: String) {
} }
fun UIKitModifier.applyWhenScreenSizeIs(size: UIKitScreenSizeModifier) = size.modify(this) fun UIKitModifier.applyWhenScreenSizeIs(size: UIKitScreenSizeModifier) = size.modify(this)
val UIKitModifier.onSmallScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Small)
val UIKitModifier.onMediumScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Medium)
val UIKitModifier.onLargeScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Large)
val UIKitModifier.onXLargeScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.XLarge)

View File

@ -0,0 +1,15 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitTile(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
object Default : UIKitTile(arrayOf("uk-tile-default"))
object Muted : UIKitTile(arrayOf("uk-tile-muted"))
object Primary : UIKitTile(arrayOf("uk-tile-primary"))
object Secondary : UIKitTile(arrayOf("uk-tile-secondary"))
companion object : UIKitTile(arrayOf("uk-tile"))
}