Compare commits

..

No commits in common. "fafb7e7e04e0bebfc523f3cc6118205eaf145f93" and "efd9cb80e17d01e624bc42527ed3b70ce046fb23" have entirely different histories.

4 changed files with 11 additions and 84 deletions

View File

@ -1,10 +1,5 @@
# Changelog
## 0.1.4
* Improvements in `UIKitGrid`
* Add support of `UIKitSticky`
## 0.1.3
* Add support of sections

View File

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

View File

@ -1,41 +1,20 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitGrid(suffix: String) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-grid-$suffix")
sealed class UIKitGrid(vararg classnames: String) : UIKitModifier {
override val classes: Array<String> = classnames as Array<String>
sealed class Gap(suffix: String) : UIKitGrid(suffix) {
sealed class Gap(classname: String) : UIKitGrid(classname) {
object Small : Gap("uk-grid-small")
object Medium : Gap("uk-grid-medium")
object Large : Gap("uk-grid-large")
object Collapse : Gap("uk-grid-collapse")
object Small : Gap("small")
object Medium : Gap("medium")
object Large : Gap("large")
object Collapse : Gap("collapse")
}
object Divider : UIKitGrid("uk-grid-divider")
object Divider : UIKitGrid("divider")
object MatchHeight : UIKitGrid("uk-grid-match")
object ItemMatchHeight : UIKitGrid("uk-grid-item-match")
object MatchHeight : UIKitGrid("match")
object ItemMatchHeight : UIKitGrid("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
}
)
)
}
}

View File

@ -1,47 +0,0 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
import org.jetbrains.compose.web.css.CSSUnitLengthOrPercentage
import org.jetbrains.compose.web.css.CSSUnitValueTyped
sealed class UIKitSticky(
position: Position? = null,
start: String? = null,
end: String? = null,
offset: CSSUnitValueTyped<CSSUnitLengthOrPercentage>? = null,
overflowFlip: Boolean? = null,
animation: UIKitAnimation? = null,
classForActiveItems: String? = null,
classForInactiveItems: String? = null,
showOnUp: Boolean? = null,
media: String? = null,
targetOffset: CSSUnitValueTyped<CSSUnitLengthOrPercentage>? = null
) : UIKitModifier {
override val otherAttrs: Map<String, String> = mapOf(
buildAttribute("uk-sticky") {
"position" to position ?.name
"start" to start
"end" to end
"offset" to offset ?.toString()
"overflow-flip" to overflowFlip
"animation" to animation
"cls-active" to classForActiveItems
"cls-inactive" to classForInactiveItems
"show-on-up" to showOnUp
"media" to media
"target-offset" to targetOffset ?.toString()
}
)
sealed interface Position {
val name: String
object Top : Position {
override val name: String
get() = "top"
}
object Bottom : Position {
override val name: String
get() = "bottom"
}
}
}