36 lines
851 B
Rust
36 lines
851 B
Rust
use ratatui::layout::{Constraint, Layout, Rect};
|
|
|
|
use super::{
|
|
center_rect,
|
|
component::{list::ListComponent, Component},
|
|
PopupView,
|
|
};
|
|
|
|
pub struct SettingView {
|
|
menu: ListComponent,
|
|
area: Rect,
|
|
}
|
|
|
|
impl SettingView {}
|
|
|
|
impl Default for SettingView {
|
|
fn default() -> Self {
|
|
SettingView {
|
|
area: Rect::new(0, 0, 10, 5),
|
|
menu: ListComponent::default().selectable(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl PopupView for SettingView {
|
|
fn draw(&self, frame: &mut ratatui::Frame) {
|
|
let area = center_rect(frame.area(), self.area.width, self.area.height);
|
|
let layout = Layout::default()
|
|
.constraints([Constraint::default()])
|
|
.split(area);
|
|
frame.render_widget(self.menu.widget(), layout[0]);
|
|
}
|
|
|
|
fn handle_event(&mut self, _event: &crossterm::event::Event) {}
|
|
}
|