gitv_tui/ui/components/
title_bar.rs1use rat_widget::statusline_stacked::StatusLineStacked;
2use ratatui::buffer::Buffer;
3use ratatui::style::{Style, Stylize};
4use ratatui::widgets::Widget;
5use ratatui_macros::{line, span};
6
7use crate::app::cli::VERSION_MESSAGE;
8use crate::ui::components::DumbComponent;
9use crate::ui::layout::Layout;
10
11pub struct TitleBar;
12
13impl TitleBar {
14 pub fn render(&mut self, area: Layout, buf: &mut Buffer) {
15 let ss = StatusLineStacked::new()
16 .start(
17 line![span!(" gitv ").style(Style::new().black().on_blue()),],
18 " ",
19 )
20 .end(
21 line![
22 span!("Version").magenta(),
23 " ",
24 span!(" {} ", VERSION_MESSAGE).black().on_magenta().bold()
25 ],
26 " ",
27 );
28 ss.render(area.title_bar, buf);
29 }
30}
31
32impl DumbComponent for TitleBar {
33 fn render(&mut self, area: Layout, buf: &mut Buffer) {
34 self.render(area, buf);
35 }
36}