35 lines
806 B
Rust
35 lines
806 B
Rust
use gpui::*;
|
|
use story::{Assets, SidebarStory};
|
|
|
|
pub struct Example {
|
|
root: Entity<SidebarStory>,
|
|
}
|
|
|
|
impl Example {
|
|
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
|
let root = SidebarStory::view(window, cx);
|
|
|
|
Self { root }
|
|
}
|
|
|
|
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, _cx: &mut Context<Self>) -> impl IntoElement {
|
|
div().mt(-px(1.)).size_full().child(self.root.clone())
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let app = Application::new().with_assets(Assets);
|
|
|
|
app.run(move |cx| {
|
|
story::init(cx);
|
|
cx.activate(true);
|
|
|
|
story::create_new_window("Sidebar Example", Example::view, cx);
|
|
});
|
|
}
|