Files
ZacharyZhang-NY 48c7b09d8d T44d Web · Gallery builds for wasm32: one story per section by URL, themed by the host
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.
2026-09-29 19:16:41 -04:00

82 lines
2.0 KiB
Rust

mod more;
mod rows;
use gpui::{AnyElement, App, IntoElement, ParentElement, Window, div};
use super::Page;
use crate::step::Step;
pub const PAGE: Page = Page {
number: 8,
slug: "menus",
title: "Menus",
summary: "Rows of actions that open from a button, a right click or an arrow, and nest.",
render,
script: SCRIPT,
};
const SCRIPT: &[Step] = &[
Step::Rest,
Step::Click("file-menu"),
Step::Wait(300),
Step::Key("down"),
Step::Key("down"),
Step::Key("down"),
Step::Key("right"),
Step::Wait(400),
Step::Shot("submenu"),
Step::Key("escape"),
Step::Key("escape"),
Step::Click("view-menu"),
Step::Wait(400),
Step::Shot("checks"),
Step::Key("escape"),
Step::ClickEnd("merge"),
Step::Wait(400),
Step::Shot("split"),
Step::Key("escape"),
Step::Click("more"),
Step::Wait(400),
Step::Shot("overflow"),
Step::Key("escape"),
Step::RightAt("canvas", 180.0, 70.0),
Step::Wait(400),
Step::Shot("context"),
Step::Key("escape"),
Step::DownAt("menubar", 16.0, 12.0),
Step::UpAt("menubar", 16.0, 12.0),
Step::Wait(400),
Step::Shot("menubar"),
Step::Key("right"),
Step::Wait(300),
Step::Shot("menubar-view"),
Step::Key("escape"),
Step::Click("move"),
Step::Wait(400),
Step::Type("re"),
Step::Wait(300),
Step::Shot("searchable"),
Step::Key("escape"),
Step::RightAt("pie-area", 210.0, 130.0),
Step::Wait(600),
Step::Key("right"),
Step::Key("right"),
Step::Wait(300),
Step::Shot("pie"),
Step::Key("escape"),
Step::Rest,
];
fn render(window: &mut Window, cx: &mut App) -> AnyElement {
div()
.child(rows::file_menu(window, cx))
.child(rows::view_menu(window, cx))
.child(rows::hosts(window, cx))
.child(rows::context(window, cx))
.child(more::menu_bar(cx))
.child(more::mega_menu(cx))
.child(more::searchable(window, cx))
.child(more::pie(window, cx))
.into_any_element()
}