summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt11
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt2
2 files changed, 12 insertions, 1 deletions
diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
index da6b6914..d4872ad7 100644
--- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
+++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
@@ -1,10 +1,12 @@
package com.palantir.blueprintjs
+import org.luxons.sevenwonders.ui.utils.createElement
import org.w3c.dom.events.Event
import org.w3c.dom.events.MouseEvent
import react.RBuilder
import react.RHandler
import react.ReactElement
+import react.dom.*
typealias IconName = String
@@ -112,6 +114,15 @@ fun RBuilder.bpNonIdealState(
block()
}
+fun RBuilder.bpNonIdealState(
+ icon: IconName? = null,
+ title: String,
+ description: ReactElement? = null,
+ action: ReactElement? = null,
+ children: ReactElement? = null,
+ block: RHandler<INonIdealStateProps> = {}
+): ReactElement = bpNonIdealState(icon, createElement { h2 { +title } }, description, action, children, block)
+
fun RBuilder.bpOverlay(
isOpen: Boolean,
autoFocus: Boolean = true,
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt
index 07b3f2b5..54260a81 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt
@@ -9,7 +9,7 @@ import react.dom.*
/**
* Creates a ReactElement without appending it (so that is can be passed around).
*/
-fun createElement(block: RBuilder.() -> ReactElement): ReactElement {
+fun createElement(block: RBuilder.() -> Unit): ReactElement {
return RDOMBuilder { SPAN(attributesMapOf("class", null), it) }
.apply { block() }
.create()
bgstack15