2022-01-12 13:58:52 +00:00
|
|
|
package dev.inmo.jsuikit.modifiers
|
2021-12-22 08:38:12 +00:00
|
|
|
|
2022-05-19 07:21:39 +00:00
|
|
|
import dev.inmo.jsuikit.types.Dropdown
|
|
|
|
import dev.inmo.jsuikit.utils.*
|
2021-12-22 08:38:12 +00:00
|
|
|
|
2022-05-19 07:21:39 +00:00
|
|
|
sealed class UIKitNavbar(vararg classes: String) : UIKitModifier {
|
|
|
|
override val classes: Array<String> = classes as Array<String>
|
|
|
|
|
|
|
|
object Transparent : UIKitNavbar("uk-navbar-transparent")
|
|
|
|
object Container : UIKitNavbar("uk-navbar-container")
|
|
|
|
sealed class Dropdown(suffix: String?) : UIKitNavbar("uk-navbar-dropdown${suffix ?.let { "-$it" } ?: ""}") {
|
2021-12-22 08:38:12 +00:00
|
|
|
object Nav : Dropdown("nav")
|
|
|
|
|
2022-05-19 07:21:39 +00:00
|
|
|
sealed class Width(suffix: String) : Dropdown(suffix) {
|
|
|
|
object Two : Width("width-2")
|
|
|
|
object Three : Width("width-3")
|
|
|
|
object Four : Width("width-4")
|
|
|
|
object Five : Width("width-5")
|
|
|
|
}
|
|
|
|
|
2021-12-22 08:38:12 +00:00
|
|
|
companion object : Dropdown(null)
|
|
|
|
}
|
2022-05-19 07:21:39 +00:00
|
|
|
sealed class Alignment(val suffix: String) : UIKitNavbar("uk-navbar-$suffix") {
|
|
|
|
object Left : Alignment("left")
|
|
|
|
sealed class Center(suffix: String) : Alignment(suffix) {
|
|
|
|
object Left : Center("center-left")
|
|
|
|
object Right : Center("center-right")
|
|
|
|
|
|
|
|
companion object : Center("center")
|
|
|
|
}
|
|
|
|
object Right : Alignment("right")
|
|
|
|
}
|
|
|
|
object Item : UIKitNavbar("uk-navbar-item")
|
|
|
|
object Nav : UIKitNavbar("uk-navbar-nav")
|
|
|
|
object Subtitle : UIKitNavbar("uk-navbar-subtitle")
|
|
|
|
object Toggle : UIKitNavbar("uk-navbar-toggle")
|
|
|
|
object Sticky : UIKitNavbar("uk-navbar-sticky")
|
2021-12-22 08:38:12 +00:00
|
|
|
|
2022-05-19 07:21:39 +00:00
|
|
|
class Component internal constructor(
|
|
|
|
override val otherAttrs: Map<String, String>
|
|
|
|
) : UIKitNavbar(*UIKitNavbar.classes)
|
|
|
|
|
|
|
|
companion object : UIKitNavbar("uk-navbar") {
|
2021-12-22 08:38:12 +00:00
|
|
|
val Logo = UIKitUtility.Logo
|
2022-05-19 07:21:39 +00:00
|
|
|
|
|
|
|
operator fun invoke(
|
2022-05-19 12:44:19 +00:00
|
|
|
align: String?,
|
2022-05-19 07:21:39 +00:00
|
|
|
mode: String? = null,
|
|
|
|
delayShow: Milliseconds? = null,
|
|
|
|
delayHide: Milliseconds? = null,
|
|
|
|
boundary: String? = null,
|
|
|
|
boundaryAlign: Boolean? = null,
|
|
|
|
offset: Pixels? = null,
|
|
|
|
dropbar: Boolean? = null,
|
|
|
|
duration: Milliseconds? = null
|
|
|
|
): Component {
|
|
|
|
return Component(
|
|
|
|
mapOf(
|
|
|
|
buildAttribute(UIKitNavbar.classes.first()) {
|
|
|
|
"align" to align
|
|
|
|
"mode" to mode
|
|
|
|
"delay-show" to delayShow
|
|
|
|
"delay-hide" to delayHide
|
|
|
|
"boundary" to boundary
|
|
|
|
"boundary-align" to boundaryAlign
|
|
|
|
"offset" to offset
|
|
|
|
"dropbar" to dropbar
|
|
|
|
"duration" to duration
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
operator fun invoke(
|
|
|
|
align: Alignment? = null,
|
|
|
|
mode: UIKitDropdown.Mode? = null,
|
|
|
|
delayShow: Milliseconds? = null,
|
|
|
|
delayHide: Milliseconds? = null,
|
|
|
|
boundary: String? = null,
|
|
|
|
boundaryAlign: Boolean? = null,
|
|
|
|
offset: Pixels? = null,
|
|
|
|
dropbar: Boolean? = null,
|
|
|
|
duration: Milliseconds? = null
|
|
|
|
): Component = invoke(align ?.suffix, mode ?.name, delayShow, delayHide, boundary, boundaryAlign, offset, dropbar, duration)
|
2021-12-22 08:38:12 +00:00
|
|
|
}
|
|
|
|
}
|