traxor/src/ui/popup.rs
2024-01-30 16:10:15 +02:00

22 lines
732 B
Rust

use ratatui::layout::{Constraint, Direction, Layout, Rect};
pub fn render_popup(percent_x: u16, percent_y: u16, r: Rect) -> Rect {
let popup_layput = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Percentage((100 - percent_y) / 2),
Constraint::Percentage(percent_y),
Constraint::Percentage((100 - percent_y) / 2),
])
.split(r);
Layout::default()
.direction(Direction::Horizontal)
.constraints([
Constraint::Percentage((100 - percent_y) / 2),
Constraint::Percentage(percent_y),
Constraint::Percentage((100 - percent_y) / 2),
])
.split(popup_layput[1])[1]
}