Do not show the scrollbar when table is empty (#143)

This commit is contained in:
Floyd Wang 2024-08-14 11:13:42 +08:00 committed by GitHub
parent ccad5cd98e
commit 1da82c5453
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,7 +188,7 @@ pub trait TableDelegate: Sized + 'static {
.justify_center()
.py_6()
.text_color(cx.theme().muted_foreground.opacity(0.6))
.child(Icon::new(IconName::Inbox).size_16())
.child(Icon::new(IconName::Inbox).size_12())
.into_any_element()
}
}
@ -801,7 +801,6 @@ where
.border_color(cx.theme().border)
.bg(cx.theme().table)
.child(inner_table)
.children(self.render_scrollbar(cx))
.child(ScrollableMask::new(
cx.view().clone(),
ScrollableAxis::Horizontal,
@ -811,5 +810,8 @@ where
move |bounds, cx| view.update(cx, |r, _| r.bounds = bounds),
|_, _, _| {},
))
.when(rows_count > 0, |this| {
this.children(self.render_scrollbar(cx))
})
}
}