From 1da82c545340c643bda33184f5fa9a656b3442b5 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Wed, 14 Aug 2024 11:13:42 +0800 Subject: [PATCH] Do not show the scrollbar when table is empty (#143) --- crates/ui/src/table.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/table.rs b/crates/ui/src/table.rs index c447023b..4d5b5a53 100644 --- a/crates/ui/src/table.rs +++ b/crates/ui/src/table.rs @@ -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)) + }) } }