Skip to content

Commit

Permalink
[fluent] Refactor: Improve TopNav layout and behavior
Browse files Browse the repository at this point in the history
This commit refactors the `TopNav` component to improve its layout and behavior.

The layout of the `TopNav` component is improved by modifying the position of MenuFlyout, move it into the Box.

The behavior is improved by adding `flyoutAnchor` to the `HorizontalIndicatorContentLayout`.
  • Loading branch information
Sanlorng committed Feb 5, 2025
1 parent eec43e1 commit e524be6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions fluent/src/commonMain/kotlin/com/konyaco/fluent/component/TopNav.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,24 @@ fun TopNavItem(
)
) {
FlyoutAnchorScope {
MenuFlyout(
visible = flyoutVisible && items != null,
onDismissRequest = {
onFlyoutVisibleChanged(false)
},
placement = FlyoutPlacement.Bottom,
modifier = Modifier.flyoutSize()
) {
items?.invoke(
rememberNavigationItemsFlyoutScope(
flyoutVisible,
onFlyoutVisibleChanged
)
)
}
Box {
MenuFlyout(
visible = flyoutVisible && items != null,
onDismissRequest = {
onFlyoutVisibleChanged(false)
},
placement = FlyoutPlacement.Bottom,
modifier = Modifier.flyoutSize()
) {
items?.invoke(
rememberNavigationItemsFlyoutScope(
flyoutVisible,
onFlyoutVisibleChanged
)
)
}
HorizontalIndicatorContentLayout(
modifier = Modifier.height(40.dp),
modifier = Modifier.height(40.dp).flyoutAnchor(),
text = text,
icon = icon,
trailing = items?.let {
Expand Down

0 comments on commit e524be6

Please sign in to comment.