- Add `ColorName` enum. <img width="588" alt="image" src="https://github.com/user-attachments/assets/20670946-1a4f-45ff-b5ac-81e7eb760242" /> <img width="586" alt="image" src="https://github.com/user-attachments/assets/7ce4a87f-fa6b-4794-83c5-3f18e6d09dcb" />
40 lines
887 B
Rust
40 lines
887 B
Rust
use gpui::*;
|
|
use story::{Assets, TextStory};
|
|
|
|
pub struct Example {
|
|
root: Entity<TextStory>,
|
|
}
|
|
|
|
impl Example {
|
|
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
|
let root = TextStory::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()
|
|
.p_4()
|
|
.id("example")
|
|
.overflow_y_scroll()
|
|
.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("List Example", Example::view, cx);
|
|
});
|
|
}
|