use super::{textbox::TextBox, Element};

pub struct Chat {
    textbox: TextBox,
}

impl Chat {
    pub fn new() -> Self {
        Self {
            textbox: TextBox::new(1, 213, 31, 1),
        }
    }
}

impl Element for Chat {
    type T = ();

    fn render<
        E,
        DT: embedded_graphics::prelude::DrawTarget<
            Color = embedded_graphics::pixelcolor::Rgb565,
            Error = E,
        >,
    >(
        &mut self,
        dt: &mut DT,
    ) -> Result<(), E> {
        self.textbox.render(dt)
    }

    fn key_push(&mut self, k: crate::keyboard::KeyCode) {
        self.textbox.key_push(k);
    }
}