summaryrefslogtreecommitdiff
path: root/sw-ui-kt/src
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-24 15:23:01 +0100
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-24 15:23:01 +0100
commitc1c953d2f33061bd1d0db9c7e2c08f9e85854190 (patch)
tree61966c25af81df8dd6a2e2718ad4cc9d79835474 /sw-ui-kt/src
parentEnable redux dev tools (diff)
downloadseven-wonders-c1c953d2f33061bd1d0db9c7e2c08f9e85854190.tar.gz
seven-wonders-c1c953d2f33061bd1d0db9c7e2c08f9e85854190.tar.bz2
seven-wonders-c1c953d2f33061bd1d0db9c7e2c08f9e85854190.zip
Add blueprint NonIdealState
Diffstat (limited to 'sw-ui-kt/src')
-rw-r--r--sw-ui-kt/src/main/kotlin/blueprintjs.kt27
-rw-r--r--sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt18
2 files changed, 45 insertions, 0 deletions
diff --git a/sw-ui-kt/src/main/kotlin/blueprintjs.kt b/sw-ui-kt/src/main/kotlin/blueprintjs.kt
index 81227835..2a2bfdce 100644
--- a/sw-ui-kt/src/main/kotlin/blueprintjs.kt
+++ b/sw-ui-kt/src/main/kotlin/blueprintjs.kt
@@ -322,6 +322,33 @@ external class Tag : PureComponent<ITagProps, RState> {
override fun render(): ReactElement
}
+external interface INonIdealStateProps : IProps {
+ /** An action to resolve the non-ideal state which appears after `description`. */
+ var action: ReactElement?
+
+ /**
+ * Advanced usage: React `children` will appear last (after `action`).
+ * Avoid passing raw strings as they will not receive margins and disrupt the layout flow.
+ */
+ var children: ReactElement?
+
+ /**
+ * A longer description of the non-ideal state.
+ * A string or number value will be wrapped in a `<div>` to preserve margins.
+ */
+ var description: ReactElement?
+
+ /** The name of a Blueprint icon or a JSX Element (such as `<Spinner/>`) to render above the title. */
+ var icon: IconName?
+
+ /** The title of the non-ideal state. */
+ var title: ReactElement?
+}
+
+external class NonIdealState : PureComponent<INonIdealStateProps, RState> {
+ override fun render(): ReactElement?
+}
+
external class Classes {
companion object {
val HTML_TABLE: String = definedExternally
diff --git a/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt b/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
index 0d9cb9bd..1b20423c 100644
--- a/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
+++ b/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt
@@ -79,3 +79,21 @@ fun RBuilder.bpTag(
}
block()
}
+
+fun RBuilder.bpNonIdealState(
+ icon: IconName? = null,
+ title: ReactElement? = null,
+ description: ReactElement? = null,
+ action: ReactElement? = null,
+ children: ReactElement? = null,
+ block: RHandler<INonIdealStateProps> = {}
+): ReactElement = child(NonIdealState::class) {
+ attrs {
+ this.icon = icon
+ this.title = title
+ this.description = description
+ this.action = action
+ this.children = children
+ }
+ block()
+}
bgstack15