2022-01-12 10:27:49 +00:00
|
|
|
package dev.inmo.jsuikit.elements
|
2021-12-22 08:38:12 +00:00
|
|
|
|
|
|
|
import androidx.compose.runtime.Composable
|
2022-01-12 13:58:52 +00:00
|
|
|
import dev.inmo.jsuikit.modifiers.UIKitModifier
|
|
|
|
import dev.inmo.jsuikit.modifiers.include
|
2022-01-13 05:55:08 +00:00
|
|
|
import org.jetbrains.compose.web.dom.*
|
|
|
|
import org.w3c.dom.HTMLSpanElement
|
2021-12-22 08:38:12 +00:00
|
|
|
|
|
|
|
sealed interface Label {
|
|
|
|
val suffix: String
|
|
|
|
|
|
|
|
@Composable
|
2022-01-13 13:56:39 +00:00
|
|
|
fun draw(
|
2021-12-22 08:38:12 +00:00
|
|
|
text: String,
|
2022-01-13 13:56:39 +00:00
|
|
|
vararg modifiers: UIKitModifier,
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer: AttrBuilderContext<HTMLSpanElement> = {},
|
2021-12-22 08:38:12 +00:00
|
|
|
) = Span(
|
|
|
|
{
|
|
|
|
classes("uk-label", "uk-label-$suffix")
|
|
|
|
include(*modifiers)
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer()
|
2021-12-22 08:38:12 +00:00
|
|
|
}
|
|
|
|
) {
|
|
|
|
Text(text)
|
|
|
|
}
|
|
|
|
|
|
|
|
object Success : Label {
|
|
|
|
override val suffix: String
|
|
|
|
get() = "success"
|
|
|
|
}
|
|
|
|
|
|
|
|
object Warning : Label {
|
|
|
|
override val suffix: String
|
|
|
|
get() = "warning"
|
|
|
|
}
|
|
|
|
|
|
|
|
object Error : Label {
|
|
|
|
override val suffix: String
|
|
|
|
get() = "danger"
|
|
|
|
}
|
|
|
|
}
|