collab_notification.rs

 1use gpui::prelude::*;
 2use story::{Story, StoryItem, StorySection};
 3use ui::prelude::*;
 4
 5use crate::notifications::collab_notification::CollabNotification;
 6
 7pub struct CollabNotificationStory;
 8
 9impl Render for CollabNotificationStory {
10    fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
11        let window_container = |width, height| div().w(px(width)).h(px(height));
12
13        Story::container(cx)
14            .child(Story::title_for::<CollabNotification>(cx))
15            .child(
16                StorySection::new().child(StoryItem::new(
17                    "Incoming Call Notification",
18                    window_container(400., 72.).child(
19                        CollabNotification::new(
20                            "https://avatars.githubusercontent.com/u/1486634?v=4",
21                            Button::new("accept", "Accept"),
22                            Button::new("decline", "Decline"),
23                        )
24                        .child(
25                            v_flex()
26                                .overflow_hidden()
27                                .child(Label::new("maxdeviant is sharing a project in Zed")),
28                        ),
29                    ),
30                )),
31            )
32            .child(
33                StorySection::new().child(StoryItem::new(
34                    "Project Shared Notification",
35                    window_container(400., 72.).child(
36                        CollabNotification::new(
37                            "https://avatars.githubusercontent.com/u/1714999?v=4",
38                            Button::new("open", "Open"),
39                            Button::new("dismiss", "Dismiss"),
40                        )
41                        .child(Label::new("iamnbutler"))
42                        .child(Label::new("is sharing a project in Zed:"))
43                        .child(Label::new("zed")),
44                    ),
45                )),
46            )
47    }
48}