use leptos::prelude::*;

#[cfg(target_arch = "wasm32")]
use super::client::BadgeClient;
#[cfg(not(target_arch = "wasm32"))]
use super::ssr::BadgeSSR;
use crate::theme::Variant;

/// Small status badge component
#[component]
pub fn Badge(
    /// Badge content
    children: Children,
    /// Visual variant
    #[prop(default = Variant::Primary)]
    variant: Variant,
    /// Additional CSS classes
    #[prop(default = "")]
    class: &'static str,
) -> impl IntoView {
    #[cfg(not(target_arch = "wasm32"))]
    {
        view! {
            <BadgeSSR variant=variant class=class>
                {children()}
            </BadgeSSR>
        }
    }

    #[cfg(target_arch = "wasm32")]
    {
        view! {
            <BadgeClient variant=variant class=class>
                {children()}
            </BadgeClient>
        }
    }
}
