Close #773 <img width="1712" alt="image" src="https://github.com/user-attachments/assets/e27a28ca-cdd7-4970-8518-4fd0104bb3f8" />
40 lines
900 B
Rust
40 lines
900 B
Rust
use gpui::*;
|
|
use gpui_component::{
|
|
alert::Alert,
|
|
button::{Button, ButtonGroup},
|
|
v_flex, IconName, Selectable as _, Sizable as _, Size,
|
|
};
|
|
use story::{AlertStory, Assets};
|
|
|
|
pub struct Example {
|
|
story: Entity<AlertStory>,
|
|
}
|
|
|
|
impl Example {
|
|
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
|
Self {
|
|
story: AlertStory::view(window, cx),
|
|
}
|
|
}
|
|
|
|
fn view(window: &mut Window, cx: &mut App) -> Entity<Self> {
|
|
cx.new(|cx| Self::new(window, cx))
|
|
}
|
|
}
|
|
|
|
impl Render for Example {
|
|
fn render(&mut self, _window: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
|
self.story.clone()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let app = Application::new().with_assets(Assets);
|
|
|
|
app.run(move |cx| {
|
|
story::init(cx);
|
|
cx.activate(true);
|
|
|
|
story::create_new_window("Alert Example", Example::view, cx);
|
|
});
|
|
}
|