refactor: reuse shortcut sanitizer and scrollbar styling
This commit is contained in:
1 parent
7e7e5c0c31
commit
22a3eebe78
8 files changed
+25
-87
No files matched your search
@@ -6,6 +6,7 @@ use crossterm::event::KeyEvent;
|
||||
use ratatui::{
|
||||
style::{Color, Modifier, Style},
|
||||
text::{Line, Span},
|
||||
widgets::{Scrollbar, ScrollbarOrientation},
|
||||
};
|
||||
|
||||
pub mod account;
|
||||
@@ -47,6 +48,16 @@ pub(crate) fn status_badge(label: impl Into<String>, color: Color) -> Span<'stat
|
||||
Span::styled(format!(" {} ", label.into()), status_badge_style(color))
|
||||
}
|
||||
|
||||
pub(crate) fn scrollbar(color: Color) -> Scrollbar<'static> {
|
||||
Scrollbar::default()
|
||||
.orientation(ScrollbarOrientation::VerticalRight)
|
||||
.begin_symbol(Some("\u{25b2}"))
|
||||
.style(Style::default().fg(color).add_modifier(Modifier::BOLD))
|
||||
.thumb_symbol("\u{2551}")
|
||||
.track_symbol(Some(""))
|
||||
.end_symbol(Some("\u{25bc}"))
|
||||
}
|
||||
|
||||
pub trait WidgetKey {
|
||||
fn handle_key(&mut self, key_event: &KeyEvent);
|
||||
}
|
||||
Reference in new issue
Block a user