diff --git a/CHANGELOG.md b/CHANGELOG.md index df0bb39..eed777d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Button.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Button.kt index 01b0dcb..428313b 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Button.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Button.kt @@ -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 = {}, contentAllocator: ContentBuilder @@ -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? = null, afterTextContentAllocator: ContentBuilder? = null, attributesCustomizer: AttrBuilderContext = {}, 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() } diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitButton.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitButton.kt index dfcf294..92a4ef4 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitButton.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitButton.kt @@ -1,7 +1,7 @@ package dev.inmo.jsuikit.modifiers -sealed class UIKitButton(suffix: String) : UIKitModifier { - override val classes: Array = arrayOf("uk-button-$suffix") +sealed class UIKitButton(suffix: String?) : UIKitModifier { + override val classes: Array = 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) }