| 38 | mut self, |
| 39 | callback: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, |
| 40 | ) -> Self { |
| 41 | self.on_click = Some(Box::new(callback)); |
| 42 | self |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | impl RenderOnce for PanelTab { |
| 47 | fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement { |
| 48 | let theme = cx.theme(); |
| 49 | let is_active = self.is_active; |
| 50 | let activation_progress = self.activation_progress; |
| 51 | |
| 52 | div() |
| 53 | .id(self.label) |
| 54 | .flex() |
| 55 | .items_center() |
| 56 | .gap(px(6.0)) |
| 57 | .h(px(28.0)) |
| 58 | .px(px(10.0)) |
| 59 | .mx(px(2.0)) |
| 60 | .rounded(px(4.0)) |
| 61 | .cursor_pointer() |
| 62 | .text_size(px(11.0)) |
| 63 | .font_weight(if is_active { |
| 64 | gpui::FontWeight::MEDIUM |
| 65 | } else { |
| 66 | gpui::FontWeight::NORMAL |
| 67 | }) |
| 68 | .when(is_active, |style| { |
| 69 | style |
| 70 | .bg(motion::mix( |
| 71 | theme.secondary, |
| 72 | theme.muted, |
| 73 | activation_progress, |
| 74 | )) |
| 75 | .text_color(motion::mix( |
| 76 | theme.muted_foreground, |
| 77 | theme.foreground, |