Change summary
crates/ui2/src/components/workspace.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Detailed changes
@@ -23,10 +23,6 @@ pub struct Workspace {
bottom_panel_scroll_state: ScrollState,
}
-fn workspace(cx: &mut WindowContext) -> View<Workspace> {
- view(cx.entity(|cx| Workspace::new()), Workspace::render)
-}
-
impl Workspace {
pub fn new() -> Self {
Self {
@@ -109,6 +105,10 @@ impl Workspace {
cx.notify();
}
+ pub fn view(cx: &mut WindowContext) -> View<Self> {
+ view(cx.entity(|cx| Self::new()), Self::render)
+ }
+
pub fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
let theme = theme(cx).clone();
@@ -285,7 +285,7 @@ mod stories {
pub fn view(cx: &mut WindowContext) -> View<Self> {
view(
cx.entity(|cx| Self {
- workspace: workspace(cx),
+ workspace: Workspace::view(cx),
}),
|view, cx| view.workspace.clone(),
)