summaryrefslogtreecommitdiff
path: root/sw-ui
diff options
context:
space:
mode:
Diffstat (limited to 'sw-ui')
-rw-r--r--sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt4
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt9
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt10
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt16
4 files changed, 6 insertions, 33 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 d486f818..bf4df032 100644
--- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
+++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
@@ -1,11 +1,11 @@
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.buildElement
import react.dom.*
typealias IconName = String
@@ -129,7 +129,7 @@ fun RBuilder.bpNonIdealState(
action: ReactElement? = null,
children: ReactElement? = null,
block: RHandler<INonIdealStateProps> = {}
-): ReactElement = bpNonIdealState(icon, createElement { h2 { +title } }, description, action, children, block)
+): ReactElement = bpNonIdealState(icon, buildElement { h2 { +title } }, description, action, children, block)
fun RBuilder.bpOverlay(
isOpen: Boolean,
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt
index 6b04801e..a33c0507 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt
@@ -7,14 +7,9 @@ import kotlinx.css.*
import kotlinx.html.js.onSubmitFunction
import org.luxons.sevenwonders.ui.redux.RequestCreateGame
import org.luxons.sevenwonders.ui.redux.connectDispatch
-import org.luxons.sevenwonders.ui.utils.createElement
import org.w3c.dom.HTMLInputElement
import org.w3c.dom.events.Event
-import react.RBuilder
-import react.RClass
-import react.RComponent
-import react.RProps
-import react.RState
+import react.*
import react.dom.*
import styled.css
import styled.styledDiv
@@ -56,7 +51,7 @@ private class CreateGameForm(props: CreateGameFormProps) : RComponent<CreateGame
}
}
- private fun createGameButton() = createElement {
+ private fun createGameButton() = buildElement {
bpButton(minimal = true, intent = Intent.PRIMARY, icon = "add", onClick = { e -> createGame(e) })
}
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt
index e6052f22..c4d424fa 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt
@@ -6,15 +6,9 @@ import com.palantir.blueprintjs.bpInputGroup
import kotlinx.html.js.onSubmitFunction
import org.luxons.sevenwonders.ui.redux.RequestChooseName
import org.luxons.sevenwonders.ui.redux.connectDispatch
-import org.luxons.sevenwonders.ui.utils.createElement
import org.w3c.dom.HTMLInputElement
import org.w3c.dom.events.Event
-import react.RBuilder
-import react.RClass
-import react.RComponent
-import react.RProps
-import react.RState
-import react.ReactElement
+import react.*
import react.dom.*
private interface ChooseNameFormProps : RProps {
@@ -44,7 +38,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseName
}
}
- private fun submitButton(): ReactElement = createElement {
+ private fun submitButton(): ReactElement = buildElement {
bpButton(
minimal = true,
icon = "arrow-right",
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
deleted file mode 100644
index 54260a81..00000000
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/utils/ReactUtils.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.luxons.sevenwonders.ui.utils
-
-import kotlinx.html.SPAN
-import kotlinx.html.attributesMapOf
-import react.RBuilder
-import react.ReactElement
-import react.dom.*
-
-/**
- * Creates a ReactElement without appending it (so that is can be passed around).
- */
-fun createElement(block: RBuilder.() -> Unit): ReactElement {
- return RDOMBuilder { SPAN(attributesMapOf("class", null), it) }
- .apply { block() }
- .create()
-}
bgstack15