21 lines
623 B
Rust
21 lines
623 B
Rust
use ratatui::layout::Rect;
|
|
use ratatui::style::Style;
|
|
use ratatui::text::{Line, Span};
|
|
use ratatui::widgets::Paragraph;
|
|
use ratatui::Frame;
|
|
|
|
use crate::theme;
|
|
|
|
pub fn render_search_bar(frame: &mut Frame, area: Rect, query: &str, active: bool) {
|
|
let theme = theme::get();
|
|
let style = if active {
|
|
Style::new().fg(theme.search.active)
|
|
} else {
|
|
Style::new().fg(theme.search.inactive)
|
|
};
|
|
let cursor = if active { "_" } else { "" };
|
|
let text = format!(" /{query}{cursor}");
|
|
let line = Line::from(Span::styled(text, style));
|
|
frame.render_widget(Paragraph::new(vec![line]), area);
|
|
}
|