From 4e0cc3621c329ce909c2641648d537e929c7ecef Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 25 Jan 2022 13:15:04 +0600 Subject: [PATCH 1/2] start 0.0.21 --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed777d..e0d4de7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.0.21 + ## 0.0.20 * Remove type of button from `DefaultButton` and add companion to `UIKitButton` to be able to use `uk-button` class diff --git a/gradle.properties b/gradle.properties index 7de392c..5db2102 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.0.20 +version=0.0.21 From 6b60d22e1e86e745f0d31f74efd1b8d9ad3738cf Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 25 Jan 2022 13:15:37 +0600 Subject: [PATCH 2/2] upfill UIKitWidth --- CHANGELOG.md | 3 + .../modifiers/UIKitScreenSizeModifier.kt | 2 + .../dev/inmo/jsuikit/modifiers/UIKitWidth.kt | 65 ++++++++++++++++--- 3 files changed, 62 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0d4de7..6df7d38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.0.21 +* Upfill `UIKitWidth` +* New extension `UIKitModifier#applyWhenScreenSizeIs` + ## 0.0.20 * Remove type of button from `DefaultButton` and add companion to `UIKitButton` to be able to use `uk-button` class diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt index 107aefd..f5e4248 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt @@ -18,3 +18,5 @@ sealed class UIKitScreenSizeModifier(val name: String) { modifier ) } + +fun UIKitModifier.applyWhenScreenSizeIs(size: UIKitScreenSizeModifier) = size.modify(this) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitWidth.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitWidth.kt index c337369..724b879 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitWidth.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitWidth.kt @@ -3,8 +3,9 @@ package dev.inmo.jsuikit.modifiers sealed class UIKitWidth(classname: String) : UIKitModifier { override val classes: Array = arrayOf("uk-width-$classname") - object Full : UIKitWidth("1-1") + object Auto : UIKitWidth("auto") object Expand : UIKitWidth("expand") + object Full : UIKitWidth("1-1") object Half : UIKitWidth("1-2") @@ -12,22 +13,70 @@ sealed class UIKitWidth(classname: String) : UIKitModifier { object TwoThird : UIKitWidth("2-3") object OneFourth : UIKitWidth("1-4") - val TwoFourth get() = Half object ThreeFourth : UIKitWidth("3-4") - val FourFourth get() = Full object OneFifth : UIKitWidth("1-5") object TwoFifth : UIKitWidth("2-5") object ThreeFifth : UIKitWidth("3-5") object FourFifth : UIKitWidth("4-5") - val FiveFifth get() = Full object OneSixth : UIKitWidth("1-6") - val TwoSixth get() = OneThird - val ThreeSixth get() = Half - val FourSixth get() = TwoThird object FiveSixth : UIKitWidth("5-6") - val SixSixth get() = Full + + sealed class Child(suffix: String) : UIKitWidth("child-$suffix") { + object Full : Child("1-1") + + object Half : Child("1-2") + + object OneThird : Child("1-3") + object TwoThird : Child("2-3") + + object OneFourth : Child("1-4") + object ThreeFourth : Child("3-4") + + object OneFifth : Child("1-5") + object TwoFifth : Child("2-5") + object ThreeFifth : Child("3-5") + object FourFifth : Child("4-5") + + object OneSixth : Child("1-6") + object FiveSixth : Child("5-6") + + object Auto : Child("auto") + object Expand : Child("expand") + + companion object { + + val TwoFourth get() = Half + val TwoSixth get() = OneThird + val ThreeSixth get() = Half + val FourSixth get() = TwoThird + val FourFourth get() = Full + val FiveFifth get() = Full + val SixSixth get() = Full + } + } + + sealed class Fixed(suffix: String) : UIKitWidth("fixed-$suffix") { + + object Small : Fixed("small") + object Medium : Fixed("medium") + object Large : Fixed("large") + object XLarge : Fixed("xlarge") + object XXLarge : Fixed("2xlarge") + + } override fun toString() = classes.first() + + companion object { + + val TwoFourth get() = Half + val TwoSixth get() = OneThird + val ThreeSixth get() = Half + val FourSixth get() = TwoThird + val FourFourth get() = Full + val FiveFifth get() = Full + val SixSixth get() = Full + } }