mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-30 05:58:45 +00:00
commit
fafb7e7e04
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.1.4
|
||||||
|
|
||||||
|
* Improvements in `UIKitGrid`
|
||||||
|
* Add support of `UIKitSticky`
|
||||||
|
|
||||||
## 0.1.3
|
## 0.1.3
|
||||||
|
|
||||||
* Add support of sections
|
* Add support of sections
|
||||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.1.3
|
version=0.1.4
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
47
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitSticky.kt
Normal file
47
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitSticky.kt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user