2022-02-09 07:43:56 +00:00
|
|
|
package dev.inmo.jsuikit.elements
|
|
|
|
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import dev.inmo.jsuikit.buildAndAddAttribute
|
2022-02-09 07:53:56 +00:00
|
|
|
import dev.inmo.jsuikit.modifiers.*
|
2022-02-09 07:43:56 +00:00
|
|
|
import dev.inmo.jsuikit.utils.Attrs
|
|
|
|
import dev.inmo.jsuikit.utils.Milliseconds
|
2022-02-09 07:53:56 +00:00
|
|
|
import org.jetbrains.compose.web.dom.*
|
|
|
|
import org.w3c.dom.HTMLAnchorElement
|
2022-02-09 07:43:56 +00:00
|
|
|
import org.w3c.dom.HTMLDivElement
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun Alert(
|
2022-02-09 07:48:06 +00:00
|
|
|
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
|
2022-02-09 07:43:56 +00:00
|
|
|
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
|
|
|
|
)
|
2022-02-09 07:53:56 +00:00
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun AlertCloseButton(
|
|
|
|
attrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
|
|
|
|
content: ContentBuilder<HTMLAnchorElement> = @Composable {}
|
|
|
|
) {
|
|
|
|
A(
|
|
|
|
null,
|
|
|
|
{
|
2022-02-09 09:28:47 +00:00
|
|
|
include(UIKitAlert.Close, UIKitIcon)
|
2022-02-09 07:53:56 +00:00
|
|
|
attr("uk-close", "")
|
2022-02-09 09:28:47 +00:00
|
|
|
classes("uk-close")
|
2022-02-09 07:53:56 +00:00
|
|
|
attrs.builder(this)
|
|
|
|
},
|
|
|
|
content
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|