From eeb9e9096c61c8d3fa7d50b88201a3c2b3de364d Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Fri, 22 May 2020 14:59:12 +0200 Subject: Add non ideal state overload with String for title --- .../kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt | 11 +++++++++++ .../kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'sw-ui/src/main/kotlin') 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 = {} +): 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() -- cgit