blob: 83f03676242a890371c379781419eb9a44865791 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package pl.treksoft.kvision.html
import com.github.snabbdom.VNode
import pl.treksoft.kvision.core.ResString
import pl.treksoft.kvision.panel.SimplePanel
import pl.treksoft.kvision.core.StringPair
open class Link(
label: String, url: String, icon: String? = null, image: ResString? = null,
classes: Set<String> = setOf()
) : SimplePanel(classes) {
private var label = label
set(value) {
field = value
refresh()
}
private var url = url
set(value) {
field = value
refresh()
}
private var icon = icon
set(value) {
field = value
refresh()
}
private var image = image
set(value) {
field = value
refresh()
}
override fun render(): VNode {
val t = createLabelWithIcon(label, icon, image)
return kvh("a", t + childrenVNodes())
}
override fun getSnAttrs(): List<StringPair> {
return super.getSnAttrs() + ("href" to url)
}
}
|