Monster commit: native version
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::theme::{browser, search};
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
use ratatui::style::{Modifier, Style};
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::{Block, Borders, Paragraph};
|
||||
use ratatui::Frame;
|
||||
@@ -59,9 +60,9 @@ impl<'a> SampleBrowser<'a> {
|
||||
|
||||
pub fn render(self, frame: &mut Frame, area: Rect) {
|
||||
let border_style = if self.focused {
|
||||
Style::new().fg(Color::Yellow)
|
||||
Style::new().fg(browser::FOCUSED_BORDER)
|
||||
} else {
|
||||
Style::new().fg(Color::DarkGray)
|
||||
Style::new().fg(browser::UNFOCUSED_BORDER)
|
||||
};
|
||||
|
||||
let block = Block::default()
|
||||
@@ -96,9 +97,9 @@ impl<'a> SampleBrowser<'a> {
|
||||
|
||||
fn render_search(&self, frame: &mut Frame, area: Rect) {
|
||||
let style = if self.search_active {
|
||||
Style::new().fg(Color::Yellow)
|
||||
Style::new().fg(search::ACTIVE)
|
||||
} else {
|
||||
Style::new().fg(Color::DarkGray)
|
||||
Style::new().fg(search::INACTIVE)
|
||||
};
|
||||
let cursor = if self.search_active { "_" } else { "" };
|
||||
let text = format!("/{}{}", self.search_query, cursor);
|
||||
@@ -114,7 +115,7 @@ impl<'a> SampleBrowser<'a> {
|
||||
} else {
|
||||
"No matches"
|
||||
};
|
||||
let line = Line::from(Span::styled(msg, Style::new().fg(Color::DarkGray)));
|
||||
let line = Line::from(Span::styled(msg, Style::new().fg(browser::EMPTY_TEXT)));
|
||||
frame.render_widget(Paragraph::new(vec![line]), area);
|
||||
return;
|
||||
}
|
||||
@@ -129,23 +130,23 @@ impl<'a> SampleBrowser<'a> {
|
||||
|
||||
let (icon, icon_color) = match entry.kind {
|
||||
TreeLineKind::Root { expanded: true } | TreeLineKind::Folder { expanded: true } => {
|
||||
("\u{25BC} ", Color::Cyan)
|
||||
("\u{25BC} ", browser::FOLDER_ICON)
|
||||
}
|
||||
TreeLineKind::Root { expanded: false }
|
||||
| TreeLineKind::Folder { expanded: false } => ("\u{25B6} ", Color::Cyan),
|
||||
TreeLineKind::File => ("\u{266A} ", Color::DarkGray),
|
||||
| TreeLineKind::Folder { expanded: false } => ("\u{25B6} ", browser::FOLDER_ICON),
|
||||
TreeLineKind::File => ("\u{266A} ", browser::FILE_ICON),
|
||||
};
|
||||
|
||||
let label_style = if is_cursor && self.focused {
|
||||
Style::new().fg(Color::Yellow).add_modifier(Modifier::BOLD)
|
||||
Style::new().fg(browser::SELECTED).add_modifier(Modifier::BOLD)
|
||||
} else if is_cursor {
|
||||
Style::new().fg(Color::White)
|
||||
Style::new().fg(browser::FILE)
|
||||
} else {
|
||||
match entry.kind {
|
||||
TreeLineKind::Root { .. } => {
|
||||
Style::new().fg(Color::White).add_modifier(Modifier::BOLD)
|
||||
Style::new().fg(browser::ROOT).add_modifier(Modifier::BOLD)
|
||||
}
|
||||
TreeLineKind::Folder { .. } => Style::new().fg(Color::Cyan),
|
||||
TreeLineKind::Folder { .. } => Style::new().fg(browser::DIRECTORY),
|
||||
TreeLineKind::File => Style::default(),
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user