| 1 | use super::ListItem; |
| 2 | use crate::{skeleton::Skeleton, v_flex}; |
| 3 | use gpui::{IntoElement, ParentElement as _, RenderOnce, Styled}; |
| 4 | |
| 5 | #[derive(IntoElement)] |
| 6 | pub struct Loading; |
| 7 | |
| 8 | #[derive(IntoElement)] |
| 9 | struct LoadingItem; |
| 10 | |
| 11 | impl 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 | |
| 23 | impl 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 | } |