use crate::app::Route;
use yew::prelude::*;
use yew_router::prelude::*;

#[function_component(Navbar)]
pub fn navbar() -> Html {
    let route = use_route::<Route>().unwrap_or(Route::Home);

    html! {
        <nav class="navbar-dock">
            <Link<Route>
                to={Route::Home}
                classes={classes!("nav-link", if route == Route::Home { "active" } else { "" })}
            >
                { "Home" }
            </Link<Route>>

            <Link<Route>
                to={Route::News}
                classes={classes!("nav-link", if route == Route::News { "active" } else { "" })}
            >
                { "News" }
            </Link<Route>>

            <Link<Route>
                to={Route::Greet}
                classes={classes!("nav-link", if route == Route::Greet { "active" } else { "" })}
            >
                { "Greet" }
            </Link<Route>>
        </nav>
    }
}
