use ratatui::{Frame, layout::Rect};
use crate::core::model::component_context::ComponentContext;
use crate::tui::component_impl::TuiComponent;
pub struct ModalComponent;
impl TuiComponent for ModalComponent {
fn name(&self) -> &'static str {
"Modal"
}
fn render(
&self,
ctx: &ComponentContext,
area: Rect,
frame: &mut Frame,
render_child: &mut dyn FnMut(&str, Rect, &mut Frame),
) {
let comp_model = match ctx.components.get(&ctx.component_id) {
Some(m) => m,
None => return,
};
if let Some(trigger_id) = comp_model.get_property::<String>("trigger") {
if area.width > 0 && area.height > 0 {
render_child(&trigger_id, area, frame);
}
}
}
}