summaryrefslogtreecommitdiff
path: root/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-22 23:06:19 +0100
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-22 23:16:59 +0100
commit7730a8ad565c167029681fd15d98be6c7dce0492 (patch)
tree9f0edfc7174298d36d717586aaf35ef961d1f0f5 /sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
parentFix home refresh on enter key (diff)
downloadseven-wonders-7730a8ad565c167029681fd15d98be6c7dce0492.tar.gz
seven-wonders-7730a8ad565c167029681fd15d98be6c7dce0492.tar.bz2
seven-wonders-7730a8ad565c167029681fd15d98be6c7dce0492.zip
Migrate game browser to blueprint components
Diffstat (limited to 'sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt')
-rw-r--r--sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt46
1 files changed, 22 insertions, 24 deletions
diff --git a/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt b/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
index 5344b64e..0d9cb9bd 100644
--- a/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
+++ b/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
@@ -1,21 +1,21 @@
package com.palantir.blueprintjs
-import org.w3c.dom.HTMLElement
import org.w3c.dom.events.Event
import org.w3c.dom.events.MouseEvent
import react.RBuilder
-import react.RElementBuilder
import react.RHandler
import react.ReactElement
typealias IconName = String
-fun RBuilder.icon(
+fun RBuilder.bpIcon(
name: IconName,
size: Int = Icon.SIZE_STANDARD,
intent: Intent = Intent.NONE,
title: String? = null,
- alt: String? = null
+ alt: String? = null,
+ className: String? = null,
+ block: RHandler<IIconProps> = {}
): ReactElement = child(Icon::class) {
attrs {
this.icon = name
@@ -23,13 +23,16 @@ fun RBuilder.icon(
this.htmlTitle = title
this.intent = intent
this.title = alt
+ this.className = className
}
+ block()
}
fun RBuilder.bpButton(
minimal: Boolean = false,
large: Boolean = false,
disabled: Boolean = false,
+ title: String? = null,
icon: IconName? = null,
rightIcon: IconName? = null,
intent: Intent = Intent.NONE,
@@ -37,6 +40,7 @@ fun RBuilder.bpButton(
block: RHandler<IButtonProps> = {}
): ReactElement = child(Button::class) {
attrs {
+ this.title = title
this.minimal = minimal
this.large = large
this.disabled = disabled
@@ -48,7 +52,7 @@ fun RBuilder.bpButton(
block()
}
-fun RBuilder.inputGroup(
+fun RBuilder.bpInputGroup(
large: Boolean = false,
placeholder: String = "",
rightElement: ReactElement? = null,
@@ -62,22 +66,16 @@ fun RBuilder.inputGroup(
}
}
-data class ButtonProps(
- override var className: String? = null,
- override var intent: Intent? = Intent.NONE,
- override var disabled: Boolean? = false,
- override var icon: IconName? = null,
- override var onClick: ((event: MouseEvent) -> Unit)? = null,
- override var text: String? = null,
- override var active: Boolean? = true,
- override var alignText: Alignment? = null,
- override var elementRef: ((ref: HTMLElement?) -> Any)? = null,
- override var fill: Boolean? = null,
- override var large: Boolean? = null,
- override var loading: Boolean? = null,
- override var minimal: Boolean? = null,
- override var outlined: Boolean? = null,
- override var rightIcon: IconName? = null,
- override var small: Boolean? = null,
- override var type: String? = null
-) : IButtonProps
+fun RBuilder.bpTag(
+ intent: Intent? = null,
+ minimal: Boolean? = null,
+ active: Boolean? = null,
+ block: RHandler<ITagProps> = {}
+): ReactElement = child(Tag::class) {
+ attrs {
+ this.intent = intent
+ this.minimal = minimal
+ this.active = active
+ }
+ block()
+}
bgstack15