diff --git a/CHANGELOG.md b/CHANGELOG.md index bb0f4bd..efd7c8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.1.4 * Improvements in `UIKitGrid` +* Add support of `UIKitSticky` ## 0.1.3 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitSticky.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitSticky.kt new file mode 100644 index 0000000..00c2d71 --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitSticky.kt @@ -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? = null, + overflowFlip: Boolean? = null, + animation: UIKitAnimation? = null, + classForActiveItems: String? = null, + classForInactiveItems: String? = null, + showOnUp: Boolean? = null, + media: String? = null, + targetOffset: CSSUnitValueTyped? = null +) : UIKitModifier { + override val otherAttrs: Map = 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" + } + } +}