From 252fe4a2954f63a1591dcd320784941129a842e4 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 25 Jan 2022 20:28:50 +0600 Subject: [PATCH] extend divider --- CHANGELOG.md | 2 + .../dev/inmo/jsuikit/elements/Divider.kt | 37 ++++++++++++++++++- .../inmo/jsuikit/modifiers/UIKitDivider.kt | 10 +++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitDivider.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b6d7b..8624160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.0.25 +* Full including of divider + ## 0.0.24 * Add opportunity to fill space between header and body of table diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Divider.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Divider.kt index 97b2386..04beb82 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Divider.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Divider.kt @@ -1,7 +1,40 @@ package dev.inmo.jsuikit.elements import androidx.compose.runtime.Composable +import dev.inmo.jsuikit.modifiers.* +import org.jetbrains.compose.web.dom.AttrBuilderContext import org.jetbrains.compose.web.dom.Hr +import org.w3c.dom.HTMLHRElement + +object Divider { + @Composable + fun Common( + vararg modifiers: UIKitModifier, + attributesCustomizer: AttrBuilderContext = {} + ) = Hr { + include(*modifiers) + attributesCustomizer() + } + @Composable + fun Icon( + vararg modifiers: UIKitModifier, + attributesCustomizer: AttrBuilderContext = {} + ) = Common( + *(modifiers + UIKitDivider.Icon), attributesCustomizer = attributesCustomizer + ) + @Composable + fun Small( + vararg modifiers: UIKitModifier, + attributesCustomizer: AttrBuilderContext = {} + ) = Common( + *(modifiers + UIKitDivider.Small), attributesCustomizer = attributesCustomizer + ) + @Composable + fun Vertical( + vararg modifiers: UIKitModifier, + attributesCustomizer: AttrBuilderContext = {} + ) = Common( + *(modifiers + UIKitDivider.Vertical), attributesCustomizer = attributesCustomizer + ) +} -@Composable -fun Divider() = Hr({ classes("uk-divider-icon") }) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitDivider.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitDivider.kt new file mode 100644 index 0000000..b5b4e8a --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitDivider.kt @@ -0,0 +1,10 @@ +package dev.inmo.jsuikit.modifiers + +sealed class UIKitDivider(classname: String) : UIKitModifier { + override val classes: Array = arrayOf(classname) + + object Icon : UIKitDivider("uk-divider-icon") + object Small : UIKitDivider("uk-divider-small") + object Vertical : UIKitDivider("uk-divider-vertical") + +}