feat(tui): add per-widget config, keybinds, and scrollbar
This commit is contained in:
1 parent
aee8ebb72b
commit
96fe87fc69
12 files changed
+318
-139
No files matched your search
@@ -0,0 +1,29 @@
|
||||
use crossterm::event::KeyEvent;
|
||||
use ratatui::{
|
||||
style::{Color, Style},
|
||||
text::{Line, Span},
|
||||
};
|
||||
|
||||
pub mod account;
|
||||
pub mod content;
|
||||
pub mod details;
|
||||
pub mod instances;
|
||||
pub mod status;
|
||||
|
||||
pub fn styled_title(title: &str, highlight: bool) -> Line {
|
||||
if !highlight || title.is_empty() {
|
||||
Line::from(Span::raw(title))
|
||||
} else {
|
||||
let mut chars = title.chars();
|
||||
let first = chars.next().unwrap_or_default().to_string();
|
||||
let rest: String = chars.collect();
|
||||
Line::from(vec![
|
||||
Span::styled(first, Style::default().fg(Color::Yellow)),
|
||||
Span::raw(rest),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
pub trait WidgetKey {
|
||||
fn handle_key(&mut self, key_event: &KeyEvent);
|
||||
}
|
||||
Reference in new issue
Block a user