summary refs log tree commit diff stats
path: root/src/components/site_header.rs
blob: 65f713704a477c53172603f9fb9703e67c27f0c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use icondata_core::Icon as DataIcon;
use leptos::prelude::{ClassAttribute, ElementChild, IntoView, OnAttribute, component, view};
use leptos_icons::Icon;
use leptos_router::{NavigateOptions, hooks::use_navigate};

#[component]
pub fn SiteHeader(
    logo: DataIcon,
    back_location: &'static str,
    name: &'static str,
    #[prop(default = None)] menu: Option<String>,
) -> impl IntoView {
    let navigate = use_navigate();

    view! {
        <div
            class="flex flex-row justify-between items-center p-2 px-4 w-full h-1/12 bg-gray-100"
            on:click=move |_| {
                navigate(back_location, NavigateOptions::default());
            }
        >
            <div class="max-w-14">
                <Icon icon=logo />
            </div>
            <p class="text-xl">{name}</p>
            <div>{menu}</div>
        </div>
    }
}