use gpui::{ App, AppContext, Context, Entity, FocusHandle, Focusable, Render, Styled as _, Window, px, }; use gpui_component::{dock::PanelControl, text::TextView}; use crate::Story; pub struct WelcomeStory { focus_handle: FocusHandle, } impl WelcomeStory { pub fn view(window: &mut Window, cx: &mut App) -> Entity { cx.new(|cx| Self::new(window, cx)) } fn new(_: &mut Window, cx: &mut Context) -> Self { Self { focus_handle: cx.focus_handle(), } } } impl Story for WelcomeStory { fn title() -> &'static str { "Introduction" } fn description() -> &'static str { "UI components for building fantastic desktop application by using GPUI." } fn new_view(window: &mut Window, cx: &mut App) -> Entity { Self::view(window, cx) } fn zoomable() -> Option { None } fn paddings() -> gpui::Pixels { px(0.) } } impl Focusable for WelcomeStory { fn focus_handle(&self, _: &gpui::App) -> gpui::FocusHandle { self.focus_handle.clone() } } impl Render for WelcomeStory { fn render( &mut self, window: &mut gpui::Window, cx: &mut gpui::Context, ) -> impl gpui::IntoElement { TextView::markdown("intro", include_str!("../../../README.md"), window, cx) .p_4() .scrollable() .selectable() } }