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.
This commit is contained in:
83 files changed
+1000
-455
No files matched your search
@@ -1,5 +1,3 @@
|
||||
use std::path::Path;
|
||||
|
||||
use ely_gpui_component::{
|
||||
buttons::{Button, ButtonVariant, IconButton},
|
||||
forms::{Input, TextInput},
|
||||
@@ -14,24 +12,12 @@ use gpui::{
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{keep, row, section, set, specimen},
|
||||
ui::{keep, picture, row, section, set, specimen},
|
||||
};
|
||||
|
||||
const PHOTOS: [(&str, &str); 2] = [
|
||||
(
|
||||
concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/examples/gallery/assets/dunes.jpg"
|
||||
),
|
||||
"Dunes at first light",
|
||||
),
|
||||
(
|
||||
concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/examples/gallery/assets/atrium.jpg"
|
||||
),
|
||||
"An atrium, noon",
|
||||
),
|
||||
(asset!("dunes.jpg"), "Dunes at first light"),
|
||||
(asset!("atrium.jpg"), "An atrium, noon"),
|
||||
];
|
||||
|
||||
pub fn lightbox(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
@@ -46,7 +32,7 @@ pub fn lightbox(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
.h_32()
|
||||
.cursor_pointer()
|
||||
.child(
|
||||
Image::new(("thumb-image", ix), Path::new(*path))
|
||||
Image::new(("thumb-image", ix), picture(*path))
|
||||
.fit(ObjectFit::Cover)
|
||||
.size_full(),
|
||||
)
|
||||
@@ -57,7 +43,7 @@ pub fn lightbox(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
let (step, close) = (shown.clone(), shown.clone());
|
||||
Lightbox::new(
|
||||
"lightbox",
|
||||
PHOTOS.map(|(path, caption)| Slide::new(Path::new(path), caption)),
|
||||
PHOTOS.map(|(path, caption)| Slide::new(picture(path), caption)),
|
||||
at,
|
||||
move |_, cx| set(&close, None, cx),
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ mod guides;
|
||||
use gpui::{AnyElement, App, IntoElement, ParentElement, Window, div};
|
||||
|
||||
use super::Page;
|
||||
use crate::script::Step;
|
||||
use crate::step::Step;
|
||||
|
||||
pub const PAGE: Page = Page {
|
||||
number: 9,
|
||||
|
||||
Reference in new issue
Block a user