aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/helpers/CloseIcon.kt
blob: b5f1a642a618910161291da75a0b5697f79bdf5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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'>&times;</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")
    }

}