mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-26 20:18:49 +00:00
fixes in buttons
This commit is contained in:
parent
228138757d
commit
b60a3bc279
@ -2,6 +2,8 @@
|
||||
|
||||
## 0.0.20
|
||||
|
||||
* Remove type of button from `DefaultButton` and add companion to `UIKitButton` to be able to use `uk-button` class
|
||||
|
||||
## 0.0.19
|
||||
|
||||
* Create `Card`s implementation
|
||||
|
@ -14,7 +14,6 @@ import org.w3c.dom.events.Event
|
||||
fun DefaultButton(
|
||||
vararg modifiers: UIKitModifier,
|
||||
disabled: Boolean = false,
|
||||
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
|
||||
onClick: ((SyntheticMouseEvent) -> Unit)? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLButtonElement> = {},
|
||||
contentAllocator: ContentBuilder<HTMLButtonElement>
|
||||
@ -22,8 +21,7 @@ fun DefaultButton(
|
||||
Button(
|
||||
{
|
||||
onClick ?.let { onClick(it) }
|
||||
classes("uk-button")
|
||||
include(*modifiers, buttonType)
|
||||
include(UIKitButton, *modifiers)
|
||||
if (disabled) {
|
||||
disabled()
|
||||
}
|
||||
@ -39,12 +37,11 @@ fun DefaultButton(
|
||||
text: String,
|
||||
vararg modifiers: UIKitModifier,
|
||||
disabled: Boolean = false,
|
||||
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
|
||||
preTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
|
||||
afterTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLButtonElement> = {},
|
||||
onClick: ((SyntheticMouseEvent) -> Unit)? = null
|
||||
) = DefaultButton(*modifiers, disabled = disabled, buttonType = buttonType, onClick = onClick, attributesCustomizer = attributesCustomizer) {
|
||||
) = DefaultButton(*modifiers, disabled = disabled, onClick = onClick, attributesCustomizer = attributesCustomizer) {
|
||||
preTextContentAllocator ?.apply { preTextContentAllocator() }
|
||||
Text(text)
|
||||
afterTextContentAllocator ?.apply { afterTextContentAllocator() }
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitButton(suffix: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf("uk-button-$suffix")
|
||||
sealed class UIKitButton(suffix: String?) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf("uk-button${suffix?.let { "-$it" } ?: ""}")
|
||||
|
||||
sealed class Type(suffix: String) : UIKitButton(suffix) {
|
||||
object Default : Type("default")
|
||||
@ -11,4 +11,6 @@ sealed class UIKitButton(suffix: String) : UIKitModifier {
|
||||
object Text : Type("text")
|
||||
object Link : Type("link")
|
||||
}
|
||||
|
||||
companion object : UIKitButton(null)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user