working perfectly well
This commit is contained in:
@@ -1,13 +1,30 @@
|
||||
// src/components/handlers/sidebar.rs
|
||||
use ratatui::{
|
||||
widgets::{Block, List, ListItem},
|
||||
layout::Rect,
|
||||
layout::{Rect, Direction, Layout, Constraint},
|
||||
style::Style,
|
||||
text::Text,
|
||||
Frame,
|
||||
};
|
||||
use crate::config::colors::Theme;
|
||||
|
||||
const SIDEBAR_WIDTH: u16 = 16;
|
||||
|
||||
pub fn calculate_sidebar_layout(show_sidebar: bool, main_content_area: Rect) -> (Option<Rect>, Rect) {
|
||||
if show_sidebar {
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([
|
||||
Constraint::Length(SIDEBAR_WIDTH),
|
||||
Constraint::Min(0),
|
||||
])
|
||||
.split(main_content_area);
|
||||
(Some(chunks[0]), chunks[1])
|
||||
} else {
|
||||
(None, main_content_area)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_sidebar(f: &mut Frame, area: Rect, theme: &Theme) {
|
||||
let sidebar_block = Block::default()
|
||||
.style(Style::default().bg(theme.bg));
|
||||
|
||||
Reference in New Issue
Block a user