BlueGit

ict rusty-teams

Files

rusty-teams / vendor / gpui-component / src / list / loading.rs

loading.rs

loading.rs 929 B Download Raw
1use super::ListItem;
2use crate::{skeleton::Skeleton, v_flex};
3use gpui::{IntoElement, ParentElement as _, RenderOnce, Styled};
4
5#[derive(IntoElement)]
6pub struct Loading;
7
8#[derive(IntoElement)]
9struct LoadingItem;
10
11impl RenderOnce for LoadingItem {
12 fn render(self, _window: &mut gpui::Window, _cx: &mut gpui::App) -> impl IntoElement {
13 ListItem::new("skeleton").disabled(true).child(
14 v_flex()
15 .gap_1p5()
16 .overflow_hidden()
17 .child(Skeleton::new().h_5().w_48().max_w_full())
18 .child(Skeleton::new().secondary().h_3().w_64().max_w_full()),
19 )
20 }
21}
22
23impl RenderOnce for Loading {
24 fn render(self, _window: &mut gpui::Window, _cx: &mut gpui::App) -> impl IntoElement {
25 v_flex()
26 .py_2p5()
27 .gap_3()
28 .child(LoadingItem)
29 .child(LoadingItem)
30 .child(LoadingItem)
31 }
32}