use leptos::prelude::*;

#[cfg(target_arch = "wasm32")]
use super::client::SpinnerClient;
#[cfg(not(target_arch = "wasm32"))]
use super::ssr::SpinnerSSR;
use crate::theme::Size;

/// Loading spinner component
#[component]
pub fn Spinner(
    /// Size variant
    #[prop(default = Size::Medium)]
    size: Size,
    /// Additional CSS classes
    #[prop(default = "")]
    class: &'static str,
) -> impl IntoView {
    #[cfg(not(target_arch = "wasm32"))]
    {
        view! {
            <SpinnerSSR size=size class=class />
        }
    }

    #[cfg(target_arch = "wasm32")]
    {
        view! {
            <SpinnerClient size=size class=class />
        }
    }
}
