Files
Ely-GPUI-Components/examples/gallery/pages/settings/mod.rs
T
ZacharyZhang-NY 380cdb0676 Settings: a settings window, its sections, a search, and what fills them
SettingsLayout lists sections down the side and shows the open one, the
list going above the page in a narrow box; SettingsSection and
SettingsRow title and hold settings, a row's control wrapping under its
name. SettingsSearch finds a setting by its name or words and opens its
section. ThemeSelector, AccentColorPicker, FontSizeControl and
DensitySelector set the look; KeyboardShortcutsList finds shortcuts by
every word; ProxySettings, PrivacySettings, NotificationSettings,
StartupSettings, StorageSettings with its clear, ImportExportSettings,
ResetToDefault, FeatureFlags and DeveloperModeToggle fill the rest.
Every handler a control needs is required and fails loud when missing.
ColorPalette wraps its swatches in a row capped at its columns, so it
keeps their size in a box sized by its content, and its swatches carry
the palette's id. ThemeSwitcher points here: src/theme sits under the
chapters that draw with buttons.
2026-09-27 12:22:58 -04:00

47 lines
1.1 KiB
Rust

use gpui::{AnyElement, App, Window, div, prelude::*};
mod pages;
mod window;
use super::Page;
use crate::script::Step;
pub const PAGE: Page = Page {
number: 35,
slug: "settings",
title: "Settings",
summary: "A settings window: its sections, a search over them, and the controls each one holds.",
render,
script: SCRIPT,
};
const SCRIPT: &[Step] = &[
Step::DownAt("settings-layout", 60.0, 16.0),
Step::UpAt("settings-layout", 60.0, 16.0),
Step::Key("down"),
Step::Wait(200),
Step::Shot("keyboard"),
Step::Key("down"),
Step::Wait(200),
Step::Shot("network"),
Step::Key("down"),
Step::Wait(200),
Step::Shot("privacy"),
Step::Key("down"),
Step::Wait(200),
Step::Shot("notifications"),
Step::Key("down"),
Step::Wait(200),
Step::Shot("startup"),
Step::Key("down"),
Step::Wait(200),
Step::Shot("storage"),
Step::Key("down"),
Step::Wait(200),
Step::Shot("advanced"),
];
fn render(window: &mut Window, cx: &mut App) -> AnyElement {
div().child(window::settings(window, cx)).into_any_element()
}