upfill UIKitWidth

This commit is contained in:
InsanusMokrassar 2022-01-25 13:15:37 +06:00
parent 4e0cc3621c
commit 6b60d22e1e
3 changed files with 62 additions and 8 deletions

View File

@ -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

View File

@ -18,3 +18,5 @@ sealed class UIKitScreenSizeModifier(val name: String) {
modifier
)
}
fun UIKitModifier.applyWhenScreenSizeIs(size: UIKitScreenSizeModifier) = size.modify(this)

View File

@ -3,8 +3,9 @@ package dev.inmo.jsuikit.modifiers
sealed class UIKitWidth(classname: String) : UIKitModifier {
override val classes: Array<String> = 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")
object FiveSixth : UIKitWidth("5-6")
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
object FiveSixth : UIKitWidth("5-6")
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
}
}