Combine related conditions

This commit is contained in:
Marshall Bowers 2023-11-13 18:22:04 -05:00
parent 53117eb5e5
commit 92f2e8eb34

View file

@ -1405,15 +1405,20 @@ impl Pane {
.items_center() .items_center()
.justify_center() .justify_center()
// todo!("Nate - I need to do some work to balance all the items in the tab once things stablize") // todo!("Nate - I need to do some work to balance all the items in the tab once things stablize")
.when(close_right, |this| this.pl_3().pr_1()) .map(|this| {
.when(!close_right, |this| this.pr_1().pr_3()) if close_right {
this.pl_3().pr_1()
} else {
this.pr_1().pr_3()
}
})
.py_1() .py_1()
.bg(tab_bg) .bg(tab_bg)
.border_color(cx.theme().colors().border) .border_color(cx.theme().colors().border)
.when(ix < self.active_item_index, |this| this.border_l()) .map(|this| match ix.cmp(&self.active_item_index) {
.when(ix > self.active_item_index, |this| this.border_r()) cmp::Ordering::Less => this.border_l(),
.when(ix == self.active_item_index, |this| { cmp::Ordering::Equal => this.border_r(),
this.border_l().border_r() cmp::Ordering::Greater => this.border_l().border_r(),
}) })
// .hover(|h| h.bg(tab_hover_bg)) // .hover(|h| h.bg(tab_hover_bg))
// .active(|a| a.bg(tab_active_bg)) // .active(|a| a.bg(tab_active_bg))