Files
oak-gpui/crates/title_bar/src/stories/application_menu.rs
T
Nate Butler e26620d1cf gpui: Add a standard text example (#30747)
This is a dumb first pass at a standard text example. We'll use this to
start digging in to some text/scale rendering issues.

There will be a ton of follow-up features to this, but starting simple.

Release Notes:

- N/A
2025-05-16 17:35:44 +02:00

30 lines
794 B
Rust

use gpui::{Entity, Render};
use story::{Story, StoryItem, StorySection};
use ui::prelude::*;
use crate::application_menu::ApplicationMenu;
pub struct ApplicationMenuStory {
menu: Entity<ApplicationMenu>,
}
impl ApplicationMenuStory {
pub fn new(window: &mut Window, cx: &mut App) -> Self {
Self {
menu: cx.new(|cx| ApplicationMenu::new(window, cx)),
}
}
}
impl Render for ApplicationMenuStory {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
Story::container(cx)
.child(Story::title_for::<ApplicationMenu>(cx))
.child(StorySection::new().child(StoryItem::new(
"Application Menu",
h_flex().child(self.menu.clone()),
)))
}
}