The gallery's entry runs natively or, on wasm32, from a wasm_bindgen start through gpui_web, single-threaded with WebGL2 fallback. ?page, ?story and ?theme choose what shows; an unknown one fails in the page and the log. set_theme switches the mode later. Pictures load from ELY_GALLERY_ASSETS. scripts/stories.py writes examples/gallery/stories.json from the pages.
89 lines
2.2 KiB
Rust
89 lines
2.2 KiB
Rust
mod anchored;
|
|
mod dialogs;
|
|
mod guides;
|
|
|
|
use gpui::{AnyElement, App, IntoElement, ParentElement, Window, div};
|
|
|
|
use super::Page;
|
|
use crate::step::Step;
|
|
|
|
pub const PAGE: Page = Page {
|
|
number: 9,
|
|
slug: "overlays",
|
|
title: "Overlays",
|
|
summary: "Panels over the page: anchored to a control, over a scrim, or over everything.",
|
|
render,
|
|
script: SCRIPT,
|
|
};
|
|
|
|
const SCRIPT: &[Step] = &[
|
|
Step::Rest,
|
|
Step::Click("share"),
|
|
Step::Wait(400),
|
|
Step::Shot("popover"),
|
|
Step::Key("escape"),
|
|
Step::Hover("ada"),
|
|
Step::Wait(900),
|
|
Step::Shot("hovercard"),
|
|
Step::Hover("share"),
|
|
Step::Wait(400),
|
|
Step::Click("edit-profile"),
|
|
Step::Wait(500),
|
|
Step::Shot("dialog"),
|
|
Step::Key("escape"),
|
|
Step::Click("alert"),
|
|
Step::Wait(500),
|
|
Step::Shot("alert"),
|
|
Step::Key("escape"),
|
|
Step::Click("confirm"),
|
|
Step::Wait(500),
|
|
Step::Shot("confirm"),
|
|
Step::Key("escape"),
|
|
Step::Click("prompt"),
|
|
Step::Wait(400),
|
|
Step::Type("drafts/2027"),
|
|
Step::Wait(300),
|
|
Step::Shot("prompt"),
|
|
Step::Key("escape"),
|
|
Step::Click("fullscreen"),
|
|
Step::Wait(600),
|
|
Step::Shot("fullscreen"),
|
|
Step::Key("escape"),
|
|
Step::Click("lightbox-0"),
|
|
Step::Wait(700),
|
|
Step::Shot("lightbox"),
|
|
Step::Key("right"),
|
|
Step::Wait(500),
|
|
Step::Shot("lightbox-next"),
|
|
Step::Key("escape"),
|
|
Step::Click("tour"),
|
|
Step::Wait(700),
|
|
Step::Shot("tour"),
|
|
Step::Key("right"),
|
|
Step::Wait(700),
|
|
Step::Shot("tour-next"),
|
|
Step::Key("escape"),
|
|
Step::Click("toolbar"),
|
|
Step::Key("secondary-a"),
|
|
Step::Wait(400),
|
|
Step::Shot("toolbar"),
|
|
Step::Click("peek"),
|
|
Step::Wait(500),
|
|
Step::Shot("peek"),
|
|
Step::Click("peek"),
|
|
Step::Rest,
|
|
];
|
|
|
|
fn render(window: &mut Window, cx: &mut App) -> AnyElement {
|
|
div()
|
|
.child(anchored::popovers(window, cx))
|
|
.child(anchored::hover_card(cx))
|
|
.child(dialogs::dialogs(window, cx))
|
|
.child(guides::lightbox(window, cx))
|
|
.child(guides::tour(window, cx))
|
|
.child(guides::toolbar(window, cx))
|
|
.child(guides::peek(window, cx))
|
|
.child(dialogs::pointers(cx))
|
|
.into_any_element()
|
|
}
|