diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/helpers/CloseIcon.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/helpers/CloseIcon.kt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/helpers/CloseIcon.kt b/src/main/kotlin/pl/treksoft/kvision/helpers/CloseIcon.kt new file mode 100644 index 00000000..b5f1a642 --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/helpers/CloseIcon.kt @@ -0,0 +1,25 @@ +package pl.treksoft.kvision.helpers + +import com.github.snabbdom.VNode +import pl.treksoft.kvision.core.KVManager +import pl.treksoft.kvision.core.Widget +import pl.treksoft.kvision.snabbdom.StringBoolPair +import pl.treksoft.kvision.snabbdom.StringPair + +open class CloseIcon(classes: Set<String> = setOf()) : Widget(classes) { + + override fun render(): VNode { + return kvh("button", arrayOf(KVManager.virtualize("<span aria-hidden='true'>×</span>"))) + } + + override fun getSnClass(): List<StringBoolPair> { + val cl = super.getSnClass().toMutableList() + cl.add("close" to true) + return cl + } + + override fun getSnAttrs(): List<StringPair> { + return super.getSnAttrs() + listOf("type" to "button", "aria-label" to "Close") + } + +} |