summaryrefslogtreecommitdiff
path: root/sw-ui/src/main/kotlin
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-05-22 14:59:12 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-05-22 15:31:45 +0200
commiteeb9e9096c61c8d3fa7d50b88201a3c2b3de364d (patch)
treefa912791ee1ffc4feb633fa5e63aacdbefa98cf2 /sw-ui/src/main/kotlin
parentSplit blueprintjs declarations into multiple files (diff)
downloadseven-wonders-eeb9e9096c61c8d3fa7d50b88201a3c2b3de364d.tar.gz
seven-wonders-eeb9e9096c61c8d3fa7d50b88201a3c2b3de364d.tar.bz2
seven-wonders-eeb9e9096c61c8d3fa7d50b88201a3c2b3de364d.zip
Add non ideal state overload with String for title
Diffstat (limited to 'sw-ui/src/main/kotlin')
-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