diff options
3 files changed, 58 insertions, 0 deletions
diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt new file mode 100644 index 00000000..dc8961f1 --- /dev/null +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt @@ -0,0 +1,28 @@ +@file:JsModule("@blueprintjs/core") +package com.palantir.blueprintjs + +import org.w3c.dom.events.MouseEvent +import react.PureComponent +import react.RState +import react.ReactElement + +external interface ICardProps : IProps { + var elevation: Elevation? + get() = definedExternally + set(value) = definedExternally + var interactive: Boolean? + get() = definedExternally + set(value) = definedExternally + var onClick: ((e: MouseEvent) -> Unit)? + get() = definedExternally + set(value) = definedExternally +} + +open external class Card : PureComponent<ICardProps, RState> { + override fun render(): ReactElement + + companion object { + var displayName: String + var defaultProps: ICardProps + } +} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt index 60fd4abf..7da41fc9 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt @@ -36,6 +36,22 @@ external enum class Alignment { RIGHT } +// export declare const Elevation: { +// ZERO: 0; +// ONE: 1; +// TWO: 2; +// THREE: 3; +// FOUR: 4; +// }; +// export declare type Elevation = typeof Elevation[keyof typeof Elevation]; +external enum class Elevation { + ZERO, + ONE, + TWO, + THREE, + FOUR +} + /** * A shared base interface for all Blueprint component props. */ 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 3106630d..a366c446 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt @@ -162,3 +162,17 @@ fun RBuilder.bpCallout( } block() } + +fun RBuilder.bpCard( + elevation: Elevation = Elevation.ZERO, + interactive: Boolean = false, + onClick: () -> Unit = {}, + block: RHandler<ICardProps> = {} +): ReactElement = child(Card::class) { + attrs { + this.elevation = elevation + this.interactive = interactive + this.onClick = { onClick() } + } + block() +} |