mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-26 20:18:49 +00:00
additions in UIKitScreenSizeModifier and support of Tile
This commit is contained in:
parent
475afeb78b
commit
3ddb22341c
@ -2,6 +2,9 @@
|
||||
|
||||
## 0.0.43
|
||||
|
||||
* Several new extensions for `UIKitModifier` like `UIKitModifier#onSmallScreen`
|
||||
* Support of `Tile`
|
||||
|
||||
## 0.0.42
|
||||
|
||||
* Migration to compose 1.1.0
|
||||
|
21
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Tile.kt
Normal file
21
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Tile.kt
Normal 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
|
||||
)
|
@ -20,3 +20,12 @@ sealed class UIKitScreenSizeModifier(val name: String) {
|
||||
}
|
||||
|
||||
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)
|
||||
|
15
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitTile.kt
Normal file
15
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitTile.kt
Normal 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"))
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user