//! Web components

use rustelo_core::Result;

/// Base component trait
pub trait Component {
    /// Component name
    fn name(&self) -> &str;

    /// Render component
    fn render(&self) -> Result<String>;
}

/// Example component
pub struct ExampleComponent {
    pub name: String,
}

impl Component for ExampleComponent {
    fn name(&self) -> &str {
        &self.name
    }

    fn render(&self) -> Result<String> {
        Ok(format!("<div>Component: {}</div>", self.name))
    }
}
