panel.rs

 1use ui::prelude::*;
 2use ui::{Label, Panel};
 3
 4use crate::story::Story;
 5
 6#[derive(Element, Default)]
 7pub struct PanelStory {}
 8
 9impl PanelStory {
10    fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
11        Story::container(cx)
12            .child(Story::title_for::<_, Panel<V>>(cx))
13            .child(Story::label(cx, "Default"))
14            .child(Panel::new(
15                ScrollState::default(),
16                |_, _| {
17                    vec![div()
18                        .overflow_y_scroll(ScrollState::default())
19                        .children((0..100).map(|ix| Label::new(format!("Item {}", ix + 1))))
20                        .into_any()]
21                },
22                Box::new(()),
23            ))
24    }
25}