kjsuikit/src/main/kotlin/dev/inmo/jsuikit/defaults/Labels.kt

40 lines
877 B
Kotlin
Raw Normal View History

2021-12-22 08:38:12 +00:00
package dev.inmo.jsuikit.defaults
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.defaults.modifers.UIKitModifier
import dev.inmo.jsuikit.defaults.modifers.include
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.Text
sealed interface Label {
val suffix: String
@Composable
operator fun invoke(
text: String,
vararg modifiers: UIKitModifier
) = Span(
{
classes("uk-label", "uk-label-$suffix")
include(*modifiers)
}
) {
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"
}
}