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 10:30:45 +00:00
|
|
|
import dev.inmo.jsuikit.modifers.UIKitModifier
|
|
|
|
import dev.inmo.jsuikit.modifers.include
|
2021-12-22 08:38:12 +00:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|