fix: preserve status badges in selectors
This commit is contained in:
1 parent
17aff8ec6d
commit
3566d6b50d
7 files changed
+110
-26
No files matched your search
+12
-1
@@ -6,7 +6,7 @@
|
||||
use crate::config::theme::THEME;
|
||||
use crossterm::event::KeyEvent;
|
||||
use ratatui::{
|
||||
style::Style,
|
||||
style::{Color, Modifier, Style},
|
||||
text::{Line, Span},
|
||||
};
|
||||
|
||||
@@ -38,6 +38,17 @@ pub fn styled_title(title: &str, highlight: bool) -> Line<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn status_badge_style(color: Color) -> Style {
|
||||
Style::default()
|
||||
.fg(THEME.as_ref().background())
|
||||
.bg(color)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
pub(crate) fn status_badge(label: impl Into<String>, color: Color) -> Span<'static> {
|
||||
Span::styled(format!(" {} ", label.into()), status_badge_style(color))
|
||||
}
|
||||
|
||||
pub trait WidgetKey {
|
||||
fn handle_key(&mut self, key_event: &KeyEvent);
|
||||
}
|
||||
Reference in new issue
Block a user