stynx_code_tui/widgets/
summary_bar.rs1use ratatui::{
2 buffer::Buffer,
3 layout::Rect,
4 style::{Modifier, Style},
5 text::{Line, Span},
6 widgets::{Block, Paragraph, Widget},
7};
8
9use crate::theme;
10
11pub struct SummaryBar<'a> {
12 pub text: &'a str,
13}
14
15impl<'a> SummaryBar<'a> {
16 pub fn new(text: &'a str) -> Self {
17 Self { text }
18 }
19}
20
21impl<'a> Widget for SummaryBar<'a> {
22 fn render(self, area: Rect, buf: &mut Buffer) {
23 let pad = " ";
24 let line = Line::from(vec![
25 Span::styled(format!("{pad}✓ "), Style::default().fg(theme::SUCCESS()).add_modifier(Modifier::BOLD)),
26 Span::styled(self.text.to_string(), Style::default().fg(theme::SUBTLE()).add_modifier(Modifier::ITALIC)),
27 ]);
28 Paragraph::new(line)
29 .block(Block::default().style(Style::default().bg(theme::SURFACE())))
30 .render(area, buf);
31 }
32}