ratatui_kit/components/
adapter.rs1use crate::Component;
2use ratatui::widgets::WidgetRef;
3use ratatui_kit_macros::Props;
4use std::sync::Arc;
5
6#[derive(Props)]
7pub struct AdapterProps {
8 pub inner: Arc<dyn WidgetRef + Sync + Send + 'static>,
9}
10
11pub struct Adapter {
12 inner: Arc<dyn WidgetRef + Sync + Send + 'static>,
13}
14impl Component for Adapter {
15 type Props<'a> = AdapterProps;
16
17 fn new(props: &Self::Props<'_>) -> Self {
18 Self {
19 inner: props.inner.clone(),
20 }
21 }
22
23 fn update(
24 &mut self,
25 props: &mut Self::Props<'_>,
26 _hooks: crate::Hooks,
27 _updater: &mut crate::ComponentUpdater,
28 ) {
29 self.inner = props.inner.clone();
30 }
31
32 fn render_ref(&self, area: ratatui::layout::Rect, buf: &mut ratatui::buffer::Buffer) {
33 self.inner.render_ref(area, buf);
34 }
35}