compiled and working sidebar in ratatui

This commit is contained in:
filipriec
2025-03-21 15:53:40 +01:00
parent c46bbc26e1
commit d067f5b515
10 changed files with 134 additions and 14 deletions

View File

@@ -4,9 +4,11 @@ pub mod preview_card;
pub mod command_line;
pub mod status_line;
pub mod canvas;
pub mod sidebar;
pub use command_line::render_command_line;
pub use form::*;
pub use preview_card::render_preview_card;
pub use status_line::render_status_line;
pub use canvas::*;
pub use sidebar::*;

View File

@@ -0,0 +1,29 @@
// src/components/handlers/sidebar.rs
use ratatui::{
widgets::{Block, Borders, List, ListItem},
layout::Rect,
style::Style,
text::Text,
Frame,
};
use crate::config::colors::Theme;
pub fn render_sidebar(f: &mut Frame, area: Rect, theme: &Theme) {
let sidebar_block = Block::default()
.borders(Borders::RIGHT)
.border_style(Style::default().fg(theme.border))
.style(Style::default().bg(theme.bg));
let items = vec![
ListItem::new(Text::from(" Navigation ")),
ListItem::new(Text::from(" Search ")),
ListItem::new(Text::from(" Settings ")),
];
let list = List::new(items)
.block(sidebar_block)
.highlight_style(Style::default().fg(theme.highlight))
.highlight_symbol(">>");
f.render_widget(list, area);
}