From 70d2f14d4a34f841a3161482eec5d355cbd755f6 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 4 Feb 2018 21:49:23 +0100 Subject: Refactoring packages layout --- .../kotlin/pl/treksoft/kvision/modal/CloseIcon.kt | 25 ++++++++++++++++++++++ src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt | 9 ++++---- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 src/main/kotlin/pl/treksoft/kvision/modal/CloseIcon.kt (limited to 'src/main/kotlin/pl/treksoft/kvision/modal') diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/CloseIcon.kt b/src/main/kotlin/pl/treksoft/kvision/modal/CloseIcon.kt new file mode 100644 index 00000000..8751b03c --- /dev/null +++ b/src/main/kotlin/pl/treksoft/kvision/modal/CloseIcon.kt @@ -0,0 +1,25 @@ +package pl.treksoft.kvision.modal + +import com.github.snabbdom.VNode +import pl.treksoft.kvision.KVManager +import pl.treksoft.kvision.core.Widget +import pl.treksoft.kvision.core.StringBoolPair +import pl.treksoft.kvision.core.StringPair + +open class CloseIcon(classes: Set = setOf()) : Widget(classes) { + + override fun render(): VNode { + return kvh("button", arrayOf(KVManager.virtualize(""))) + } + + override fun getSnClass(): List { + val cl = super.getSnClass().toMutableList() + cl.add("close" to true) + return cl + } + + override fun getSnAttrs(): List { + return super.getSnAttrs() + listOf("type" to "button", "aria-label" to "Close") + } + +} diff --git a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt index 2c83077a..b5c985b7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt +++ b/src/main/kotlin/pl/treksoft/kvision/modal/Modal.kt @@ -2,16 +2,15 @@ package pl.treksoft.kvision.modal import com.github.snabbdom.VNode import pl.treksoft.kvision.core.Component -import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.core.Widget -import pl.treksoft.kvision.helpers.CloseIcon import pl.treksoft.kvision.html.Button import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag +import pl.treksoft.kvision.panel.Root import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.snabbdom.StringBoolPair -import pl.treksoft.kvision.snabbdom.StringPair -import pl.treksoft.kvision.snabbdom.obj +import pl.treksoft.kvision.core.StringBoolPair +import pl.treksoft.kvision.core.StringPair +import pl.treksoft.kvision.utils.obj enum class MODALSIZE(val className: String) { LARGE("modal-lg"), -- cgit