From 04a94cfabecb4f6c2c244b89f0627407cfa16cf7 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 16:56:39 +0600 Subject: [PATCH] add onClick callback into Close#drawAsButton --- src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt index 99dbfb0..5ee1723 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt @@ -1,6 +1,7 @@ package dev.inmo.jsuikit.elements import androidx.compose.runtime.Composable +import androidx.compose.web.events.SyntheticMouseEvent import dev.inmo.jsuikit.modifiers.UIKitClose import dev.inmo.jsuikit.modifiers.include import dev.inmo.jsuikit.utils.Attrs @@ -28,12 +29,16 @@ object Close { @Composable fun drawAsButton( attrs: Attrs = Attrs.empty(), - contentBuilder: ContentBuilder = {} + contentBuilder: ContentBuilder = {}, + onClick: ((SyntheticMouseEvent) -> Unit)? = null ) = Button( { type(ButtonType.Button) include(UIKitClose) attrs.builder(this) + onClick ?.let { + onClick(onClick) + } }, contentBuilder )