use leptos::prelude::*;

#[cfg(target_arch = "wasm32")]
use super::client::CardClient;
#[cfg(not(target_arch = "wasm32"))]
use super::ssr::CardSSR;
use crate::theme::{BlurLevel, GlowColor};

/// Glassmorphism card component
///
/// # Example
///
/// ```rust
/// use leptos::prelude::*;
/// use vapora_leptos_ui::{Card, BlurLevel, GlowColor};
///
/// view! {
///     <Card blur=BlurLevel::Md glow=GlowColor::Cyan>
///         <h2>"Card Title"</h2>
///         <p>"Card content goes here"</p>
///     </Card>
/// }
/// ```
#[component]
pub fn Card(
    /// Card content
    children: Children,
    /// Backdrop blur level
    #[prop(default = BlurLevel::Md)]
    blur: BlurLevel,
    /// Glow shadow color
    #[prop(default = GlowColor::None)]
    glow: GlowColor,
    /// Enable hover effect
    #[prop(default = false)]
    hoverable: bool,
    /// Additional CSS classes
    #[prop(default = "")]
    class: &'static str,
) -> impl IntoView {
    #[cfg(not(target_arch = "wasm32"))]
    {
        view! {
            <CardSSR
                blur=blur
                glow=glow
                hoverable=hoverable
                class=class
            >
                {children()}
            </CardSSR>
        }
    }

    #[cfg(target_arch = "wasm32")]
    {
        view! {
            <CardClient
                blur=blur
                glow=glow
                hoverable=hoverable
                class=class
            >
                {children()}
            </CardClient>
        }
    }
}
