Skip to content

Commit

Permalink
Refactor package search splitter for improved handling
Browse files Browse the repository at this point in the history
The refactoring of the "packageSearchSplitter" method in the Components.kt file has improved the handling of this functionality. By introducing a new Divider component with a Vertical Orientation, the need for a hidden state check was eliminated, simplifying the code and significantly improving readability and maintainability.

(cherry picked from commit b0281ec)
  • Loading branch information
lamba92 committed Jan 12, 2024
1 parent c224253 commit 7426b5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ import com.intellij.icons.AllIcons
import com.jetbrains.packagesearch.plugin.ui.PackageSearchColors
import com.jetbrains.packagesearch.plugin.ui.PackageSearchMetrics
import java.awt.Cursor
import org.jetbrains.compose.splitpane.SplitPaneScope
import org.jetbrains.jewel.foundation.theme.JewelTheme
import org.jetbrains.jewel.foundation.theme.LocalTextStyle
import org.jetbrains.jewel.ui.Orientation
import org.jetbrains.jewel.ui.component.Divider
import org.jetbrains.jewel.ui.component.DropdownLink
import org.jetbrains.jewel.ui.component.Icon
import org.jetbrains.jewel.ui.component.IconButton
import org.jetbrains.jewel.ui.component.MenuScope
import org.jetbrains.jewel.ui.component.PopupMenu
import org.jetbrains.jewel.ui.component.Text
import org.jetbrains.compose.splitpane.SplitPaneScope

@Composable
fun LabelInfo(
Expand Down Expand Up @@ -148,29 +150,19 @@ internal fun PackageActionPopup(
internal fun SplitPaneScope.packageSearchSplitter(
splitterColor: Color,
cursor: PointerIcon = PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR)),
hidden: Boolean = false,
) {
splitter {
visiblePart {
if (!hidden) {
Box(
modifier = Modifier
.fillMaxHeight()
.width(1.dp)
.background(splitterColor),
)
}
Divider(orientation = Orientation.Vertical, color = splitterColor)
}
handle {
if (!hidden) {
Box(
modifier = Modifier
.fillMaxHeight()
.width(8.dp)
.markAsHandle()
.pointerHoverIcon(cursor),
)
}
Box(
modifier = Modifier
.fillMaxHeight()
.width(3.dp)
.markAsHandle()
.pointerHoverIcon(cursor),
)
}
}
}
Expand Down

0 comments on commit 7426b5a

Please sign in to comment.