-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditionally render divider between button groups in the status bar #24114
Conditionally render divider between button groups in the status bar #24114
Conversation
In the left hand status bar, there are two groups of buttons. There was a border between the two hardcoded on the first button of the second group, however, if all buttons in the first group are hidden, the border doesn't need to be rendered. I think a better approach would be to change StatusBar's definition from `left_items` and `right_items` to `left_groups` and `right_groups`, and render dividers between each group of items. That seemed like a bigger refactor than I wanted to handle for now, but is an option for the future.
.pl_1() | ||
.border_l_1() | ||
.border_color(cx.theme().colors().border) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This border looks slightly darker or thicker than the default Divider. We could either:
- Use this 1px border instead of Divider.
- Modify Divider to have a darker/thicker border.
I'm assuming that the default divider is good for this use case, but happy to iterate.
.children(buttons) | ||
.when(has_buttons, |this| { | ||
this.h_flex().gap_1().child(Divider::vertical()) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My Rust is very bad, so there's likely a better way to handle this diff. I wanted to inline !buttons.is_empty()
, but ran into an error about moving buttons that I couldn't figure out. If anything here could be more idiomatic, please let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thank you!
Follow up to #24114 Just fixing the UI so that the divider only shows for the left-positioned items. Release Notes: - N/A
In the left hand status bar, there are two groups of buttons. There was a border between the two hardcoded on the first button of the second group, however, if all buttons in the first group are hidden, the border doesn't need to be rendered.
(Not handled in this PR) A potentially better approach would be to change StatusBar's definition from
left_items
andright_items
toleft_groups
andright_groups
, and render dividers between each group of items. That seemed like a bigger refactor than I wanted to handle for now, but is an option for the future.If you use these settings on
main
, the border will show, but with nothing to the left of it.Screenshots:
Before:


After:


Release Notes: