MCPcopy Create free account
hub / github.com/bajrangCoder/setu / into_element

Method into_element

src/components/tab_bar.rs:182–302  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

180 self
181 }
182
183 fn on_close(
184 mut self,
185 callback: impl Fn(&gpui::ClickEvent, &mut Window, &mut App) + 'static,
186 ) -> Self {
187 self.on_close = Some(Box::new(callback));
188 self
189 }
190}
191
192impl RenderOnce for WorkspaceTab {
193 fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
194 let theme = cx.theme();
195 let is_active = self.info.is_active;
196 let tab_id = self.info.id;
197 let tab_index = self.info.index;
198 let tab_name = self.info.name.clone();
199 let main_view_for_rename = self.main_view.clone();
200 let main_view_for_close = self.main_view.clone();
201 let main_view_for_close_others = self.main_view;
202
203 let icon_badge = match &self.info.icon {
204 TabIcon::Method(method) => {
205 let m_color = method_color(method, cx);
206 div()
207 .text_color(m_color)
208 .font_weight(gpui::FontWeight::BOLD)
209 .text_size(px(9.0))
210 .child(method.as_str())
211 .into_any_element()
212 }
213 TabIcon::Icon(icon) => div()
214 .flex()
215 .items_center()
216 .justify_center()
217 .child(
218 gpui_component::Icon::new(*icon)
219 .size(px(12.0))
220 .text_color(theme.primary),
221 )
222 .into_any_element(),
223 };
224
225 let text_color = if is_active {
226 motion::mix(
227 self.text_inactive,
228 self.text_active,
229 self.activation_progress,
230 )
231 } else {
232 self.text_inactive
233 };
234
235 div()
236 .id(("tab", tab_id))
237 .group("tab")
238 .flex()
239 .items_center()

Callers

nothing calls this directly

Calls 7

childMethod · 0.80
idMethod · 0.80
show_rename_dialogMethod · 0.80
close_tabMethod · 0.80
close_other_tabsMethod · 0.80
on_clickMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected