diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-22 15:00:17 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-05-22 15:31:45 +0200 |
commit | 4b55b9168ed03033ffd58519d8bf3d1b73c05f87 (patch) | |
tree | 2d9f59fce4245ce0dfbe9e36ee70300495b63ce6 | |
parent | Replace error message with non-ideal-state (diff) | |
download | seven-wonders-4b55b9168ed03033ffd58519d8bf3d1b73c05f87.tar.gz seven-wonders-4b55b9168ed03033ffd58519d8bf3d1b73c05f87.tar.bz2 seven-wonders-4b55b9168ed03033ffd58519d8bf3d1b73c05f87.zip |
Add callout component
-rw-r--r-- | sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt | 26 | ||||
-rw-r--r-- | sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt | 16 |
2 files changed, 42 insertions, 0 deletions
diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt new file mode 100644 index 00000000..a812d6e4 --- /dev/null +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt @@ -0,0 +1,26 @@ +@file:JsModule("@blueprintjs/core") +package com.palantir.blueprintjs + +import react.PureComponent +import react.RState + +external interface ICalloutProps : IIntentProps, IProps { + var icon: dynamic /* IconName | MaybeElement */ + get() = definedExternally + set(value) = definedExternally + override var intent: Intent? + get() = definedExternally + set(value) = definedExternally + var title: String? + get() = definedExternally + set(value) = definedExternally +} + +open external class Callout : PureComponent<ICalloutProps, RState> { + override fun render(): react.ReactElement + open var getIconName: Any + + companion object { + var displayName: String + } +} 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 d4872ad7..3106630d 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt @@ -146,3 +146,19 @@ fun RBuilder.bpOverlay( } block() } + +fun RBuilder.bpCallout( + intent: Intent? = Intent.NONE, + icon: IconName? = null, + title: String? = null, + block: RHandler<ICalloutProps> = {} +): ReactElement = child(Callout::class) { + attrs { + if (icon != null) { + this.icon = icon + } + this.title = title + this.intent = intent + } + block() +} |