//! Unified mobile menu component interface using shared delegation patterns
//!
//! This module provides a unified interface that automatically selects between
//! client-side reactive and server-side static implementations based on
//! context.

use leptos::prelude::*;

#[cfg(target_arch = "wasm32")]
use crate::ui::mobile_menu::client::{
    MobileMenu as MobileMenuClient, MobileMenuToggle as MobileMenuToggleClient,
};
#[cfg(not(target_arch = "wasm32"))]
use crate::ui::mobile_menu::ssr::{
    MobileMenu as MobileMenuSSR, MobileMenuToggle as MobileMenuToggleSSR,
};

/// Unified mobile menu toggle component that delegates to appropriate
/// implementation
#[component]
pub fn MobileMenuToggle() -> impl IntoView {
    #[cfg(not(target_arch = "wasm32"))]
    {
        // SSR context: use static implementation
        view! {
            <MobileMenuToggleSSR />
        }
    }

    #[cfg(target_arch = "wasm32")]
    {
        // Client context: use reactive implementation
        view! {
            <MobileMenuToggleClient />
        }
    }
}

/// Unified mobile menu component that delegates to appropriate implementation
#[component]
pub fn MobileMenu(children: Children) -> impl IntoView {
    #[cfg(not(target_arch = "wasm32"))]
    {
        // SSR context: use static implementation
        view! {
            <MobileMenuSSR>
                {children()}
            </MobileMenuSSR>
        }
    }

    #[cfg(target_arch = "wasm32")]
    {
        // Client context: use reactive implementation
        view! {
            <MobileMenuClient>
                {children()}
            </MobileMenuClient>
        }
    }
}
