mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-30 05:58:45 +00:00
add Alert and several things in animation
This commit is contained in:
parent
5ac4242b68
commit
01349d2fac
@ -2,6 +2,9 @@
|
||||
|
||||
## 0.0.34
|
||||
|
||||
* Add `Alert`
|
||||
* Add `Animation#KenBurns`
|
||||
|
||||
## 0.0.33
|
||||
|
||||
* Fixes in attributes building and related things
|
||||
|
30
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt
Normal file
30
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt
Normal file
@ -0,0 +1,30 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.inmo.jsuikit.buildAndAddAttribute
|
||||
import dev.inmo.jsuikit.modifiers.UIKitAnimation
|
||||
import dev.inmo.jsuikit.utils.Attrs
|
||||
import dev.inmo.jsuikit.utils.Milliseconds
|
||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Alert(
|
||||
attrs: Attrs<HTMLDivElement>,
|
||||
animation: UIKitAnimation? = UIKitAnimation.Fade,
|
||||
duration: Milliseconds? = null,
|
||||
selClose: String? = null,
|
||||
content: ContentBuilder<HTMLDivElement>
|
||||
) = Div(
|
||||
{
|
||||
attrs.builder(this)
|
||||
|
||||
buildAndAddAttribute("uk-alert") {
|
||||
"animation" to animation ?.classes ?.firstOrNull()
|
||||
"duration" to duration
|
||||
"sel-close" to selClose
|
||||
}
|
||||
},
|
||||
content
|
||||
)
|
18
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitAlert.kt
Normal file
18
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitAlert.kt
Normal file
@ -0,0 +1,18 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitAlert(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
|
||||
sealed class Style(classname: String) : UIKitAlert(classname) {
|
||||
|
||||
object Primary : Style("uk-alert-primary")
|
||||
object Success : Style("uk-alert-success")
|
||||
object Warning : Style("uk-alert-warning")
|
||||
object Danger : Style("uk-alert-danger")
|
||||
|
||||
}
|
||||
|
||||
object Close : UIKitAlert("uk-alert-close")
|
||||
|
||||
companion object : UIKitAlert("uk-alert")
|
||||
}
|
@ -60,4 +60,6 @@ sealed class UIKitAnimation (name: String) : UIKitModifier, AttributeValue(name)
|
||||
|
||||
object Fast : UIKitAnimation("fast")
|
||||
|
||||
object KenBurns : UIKitAnimation("kenburns")
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user