GPUI Box GitHub

Scenes

diff-view

Builds DiffView

diff-view in the dark theme
studio-dark
diff-view in the light theme
studio-light

The code that drew it

A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.

fn diff_view(_window: &mut Window, cx: &mut App) -> AnyElement {
    let theme = cx.theme().clone();
    stack(&theme)
        .w(px(840.0))
        .child(caption(
            &theme,
            "the same caller-owned rows arranged as unified and split",
        ))
        .child(
            div()
                .column()
                .items_start()
                .gap_token(&theme, Space::Md)
                .child(
                    div().w(px(840.0)).child(
                        DiffView::new("scene.diff.unified", scene_diff())
                            .visible_rows(7)
                            .on_event(|_, _, _| {}),
                    ),
                )
                .child(
                    div().w(px(840.0)).child(
                        DiffView::new("scene.diff.split", scene_diff())
                            .presentation(DiffPresentation::Split)
                            .visible_rows(7)
                            .on_event(|_, _, _| {}),
                    ),
                ),
        )
        .into_any_element()
}