Return impl IntoElement from Render::render trait
This commit is contained in:
@@ -505,7 +505,7 @@ impl Dock {
|
||||
}
|
||||
|
||||
impl Render for Dock {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
if let Some(entry) = self.visible_entry() {
|
||||
let size = entry.panel.size(cx);
|
||||
|
||||
@@ -592,7 +592,7 @@ impl PanelButtons {
|
||||
}
|
||||
|
||||
impl Render for PanelButtons {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
// todo!()
|
||||
let dock = self.dock.read(cx);
|
||||
let active_index = dock.active_panel_index;
|
||||
@@ -713,7 +713,7 @@ pub mod test {
|
||||
}
|
||||
|
||||
impl Render for TestPanel {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
div()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ pub mod test {
|
||||
use super::{Item, ItemEvent};
|
||||
use crate::{ItemId, ItemNavHistory, Pane, Workspace, WorkspaceId};
|
||||
use gpui::{
|
||||
AnyElement, AppContext, Context as _, Element, EntityId, EventEmitter, FocusableView,
|
||||
AnyElement, AppContext, Context as _, EntityId, EventEmitter, FocusableView,
|
||||
InteractiveElement, IntoElement, Model, Render, SharedString, Task, View, ViewContext,
|
||||
VisualContext, WeakView,
|
||||
};
|
||||
@@ -910,7 +910,7 @@ pub mod test {
|
||||
}
|
||||
|
||||
impl Render for TestItem {
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
gpui::div().track_focus(&self.focus_handle)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ impl ModalLayer {
|
||||
}
|
||||
|
||||
impl Render for ModalLayer {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let Some(active_modal) = &self.active_modal else {
|
||||
return div();
|
||||
};
|
||||
|
||||
@@ -219,7 +219,7 @@ pub mod simple_message_notification {
|
||||
}
|
||||
|
||||
impl Render for MessageNotification {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
v_stack()
|
||||
.elevation_3(cx)
|
||||
.p_4()
|
||||
|
||||
@@ -1867,7 +1867,7 @@ impl FocusableView for Pane {
|
||||
}
|
||||
|
||||
impl Render for Pane {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
v_stack()
|
||||
.key_context("Pane")
|
||||
.track_focus(&self.focus_handle)
|
||||
@@ -2746,7 +2746,7 @@ mod tests {
|
||||
}
|
||||
|
||||
impl Render for DraggedTab {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
|
||||
let item = &self.pane.read(cx).items[self.ix];
|
||||
let label = item.tab_content(Some(self.detail), false, cx);
|
||||
|
||||
@@ -66,7 +66,7 @@ impl FocusableView for SharedScreen {
|
||||
}
|
||||
}
|
||||
impl Render for SharedScreen {
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
div().track_focus(&self.focus).size_full().children(
|
||||
self.frame
|
||||
.as_ref()
|
||||
|
||||
@@ -33,7 +33,7 @@ pub struct StatusBar {
|
||||
}
|
||||
|
||||
impl Render for StatusBar {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
div()
|
||||
.py_0p5()
|
||||
.px_1()
|
||||
|
||||
@@ -93,7 +93,7 @@ impl Toolbar {
|
||||
}
|
||||
|
||||
impl Render for Toolbar {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
if !self.has_any_visible_items() {
|
||||
return div();
|
||||
}
|
||||
|
||||
@@ -3487,7 +3487,7 @@ impl FocusableView for Workspace {
|
||||
struct DraggedDock(DockPosition);
|
||||
|
||||
impl Render for Workspace {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let mut context = KeyContext::default();
|
||||
context.add("Workspace");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user