overflow_scroll.rs

 1use gpui::Render;
 2use story::Story;
 3
 4use ui::prelude::*;
 5
 6pub struct OverflowScrollStory;
 7
 8impl Render for OverflowScrollStory {
 9    fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
10        Story::container(cx)
11            .child(Story::title("Overflow Scroll", cx))
12            .child(Story::label("`overflow_x_scroll`", cx))
13            .child(
14                h_flex()
15                    .id("overflow_x_scroll")
16                    .gap_2()
17                    .overflow_x_scroll()
18                    .children((0..100).map(|i| {
19                        div()
20                            .p_4()
21                            .debug_bg_cyan()
22                            .child(SharedString::from(format!("Child {}", i + 1)))
23                    })),
24            )
25            .child(Story::label("`overflow_y_scroll`", cx))
26            .child(
27                v_flex()
28                    .w_full()
29                    .flex_1()
30                    .id("overflow_y_scroll")
31                    .gap_2()
32                    .overflow_y_scroll()
33                    .children((0..100).map(|i| {
34                        div()
35                            .p_4()
36                            .debug_bg_green()
37                            .child(SharedString::from(format!("Child {}", i + 1)))
38                    })),
39            )
40    }
41}