Merge pull request #44 from InsanusMokrassar/0.0.43

0.0.43
This commit is contained in:
InsanusMokrassar 2022-03-12 01:45:19 +06:00 committed by GitHub
commit f90055fa59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 4 deletions

View File

@ -1,5 +1,10 @@
# Changelog
## 0.0.43
* Several new extensions for `UIKitModifier` like `UIKitModifier#onSmallScreen`
* Support of `Tile`
## 0.0.42
* Migration to compose 1.1.0

View File

@ -9,4 +9,4 @@ android.enableJetifier=true
# Project data
group=dev.inmo
version=0.0.42
version=0.0.43

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -10,7 +10,7 @@ import org.w3c.dom.HTMLDivElement
fun GridColumn(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit = {}
) {
Div(
{
@ -30,7 +30,7 @@ fun Grid(
marginClass: String? = null,
firstColumnClass: String? = null,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit = {}
) {
val attrs = listOfNotNull(
if (masonry) "masonry" to "true" else null,

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