1use gpui2::geometry::{relative, rems, Size};
2
3use crate::prelude::*;
4use crate::{theme, Icon, IconButton, Pane, Tab};
5
6#[derive(Element)]
7pub struct Terminal {}
8
9impl Terminal {
10 pub fn new() -> Self {
11 Self {}
12 }
13
14 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
15 let theme = theme(cx);
16
17 let can_navigate_back = true;
18 let can_navigate_forward = false;
19
20 div()
21 .flex()
22 .flex_col()
23 .child(
24 // Terminal Tabs.
25 div()
26 .w_full()
27 .flex()
28 .fill(theme.middle.base.default.background)
29 .child(
30 div().px_1().flex().flex_none().gap_2().child(
31 div()
32 .flex()
33 .items_center()
34 .gap_px()
35 .child(
36 IconButton::new(Icon::ArrowLeft).state(
37 InteractionState::Enabled.if_enabled(can_navigate_back),
38 ),
39 )
40 .child(IconButton::new(Icon::ArrowRight).state(
41 InteractionState::Enabled.if_enabled(can_navigate_forward),
42 )),
43 ),
44 )
45 .child(
46 div().w_0().flex_1().h_full().child(
47 div()
48 .flex()
49 .child(
50 Tab::new()
51 .title("zed — fish".to_string())
52 .icon(Icon::Terminal)
53 .close_side(IconSide::Right)
54 .current(true),
55 )
56 .child(
57 Tab::new()
58 .title("zed — fish".to_string())
59 .icon(Icon::Terminal)
60 .close_side(IconSide::Right)
61 .current(false),
62 ),
63 ),
64 ),
65 )
66 // Terminal Pane.
67 .child(Pane::new(
68 ScrollState::default(),
69 Size {
70 width: relative(1.).into(),
71 height: rems(36.).into(),
72 },
73 |_, _| vec![],
74 Box::new(()),
75 ))
76 }
77}