feat: add spinner component
This commit is contained in:
@@ -25,6 +25,7 @@ sidebar = [
|
||||
tabs = [
|
||||
"dep:gpui-native-core",
|
||||
"gpui-native-core/button",
|
||||
"gpui-native-core/spinner",
|
||||
"gpui-native-core/tooltip",
|
||||
]
|
||||
tree = []
|
||||
|
||||
+6
-12
@@ -8,6 +8,7 @@ use gpui::{
|
||||
};
|
||||
use gpui_native_core::button::{Button, ButtonVariant};
|
||||
use gpui_native_core::common::Sizable as _;
|
||||
use gpui_native_core::spinner::Spinner;
|
||||
use gpui_native_core::tooltip::Tooltip;
|
||||
use gpui_native_icons::{IconRole, icon};
|
||||
use gpui_native_theme::{ActiveTheme as _, Size};
|
||||
@@ -362,7 +363,11 @@ fn render_tab(
|
||||
}
|
||||
|
||||
if tab.busy && !tab.disabled {
|
||||
strip_tab = strip_tab.child(busy_slot(cx));
|
||||
strip_tab = strip_tab.child(
|
||||
Spinner::new(("tab-busy", index))
|
||||
.small()
|
||||
.accessibility_label("Loading"),
|
||||
);
|
||||
}
|
||||
|
||||
if tab.closeable && on_close.is_some() && !tab.disabled {
|
||||
@@ -418,14 +423,3 @@ fn render_tab_close(
|
||||
})
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn busy_slot(cx: &App) -> AnyElement {
|
||||
let theme = cx.theme();
|
||||
div()
|
||||
.flex_none()
|
||||
.size(theme.sizes.medium.dense_icon_size)
|
||||
.rounded(theme.radius.full)
|
||||
.border_1()
|
||||
.border_color(theme.colors.border)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user