improvements

This commit is contained in:
InsanusMokrassar 2022-05-22 23:21:25 +06:00
parent 674fbbd4d5
commit 4377ec3969
2 changed files with 33 additions and 10 deletions

View File

@ -2,6 +2,8 @@
## 0.1.4 ## 0.1.4
* Improvements in `UIKitGrid`
## 0.1.3 ## 0.1.3
* Add support of sections * Add support of sections

View File

@ -1,20 +1,41 @@
package dev.inmo.jsuikit.modifiers package dev.inmo.jsuikit.modifiers
sealed class UIKitGrid(suffix: String) : UIKitModifier { import dev.inmo.jsuikit.utils.buildAttribute
override val classes: Array<String> = arrayOf("uk-grid-$suffix")
sealed class Gap(suffix: String) : UIKitGrid(suffix) { sealed class UIKitGrid(vararg classnames: String) : UIKitModifier {
override val classes: Array<String> = classnames as Array<String>
object Small : Gap("small") sealed class Gap(classname: String) : UIKitGrid(classname) {
object Medium : Gap("medium")
object Large : Gap("large") object Small : Gap("uk-grid-small")
object Collapse : Gap("collapse") object Medium : Gap("uk-grid-medium")
object Large : Gap("uk-grid-large")
object Collapse : Gap("uk-grid-collapse")
} }
object Divider : UIKitGrid("divider") object Divider : UIKitGrid("uk-grid-divider")
object MatchHeight : UIKitGrid("match") object MatchHeight : UIKitGrid("uk-grid-match")
object ItemMatchHeight : UIKitGrid("item-match") object ItemMatchHeight : UIKitGrid("uk-grid-item-match")
class Custom internal constructor(override val otherAttrs: Map<String, String>) : UIKitGrid()
companion object : UIKitGrid("uk-grid") {
operator fun invoke(
margin: UIKitMargin? = null,
firstColumnClass: String? = null,
masonry: Boolean? = null,
parallax: UInt? = null
) = Custom(
mapOf(
buildAttribute("uk-grid") {
margin to margin ?.classes ?.joinToString(" ")
"first-column" to firstColumnClass
"masonry" to masonry
"parallax" to parallax
}
)
)
}
} }