Skip to main content

euv_ui/component/navbar/view/
struct.rs

1use super::*;
2
3/// One link entry of the [`euv_navbar`] top navigation bar.
4///
5/// Internal links (hash routes) highlight when their path prefix matches the
6/// current route; links starting with `http` open in a new tab.
7#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
8pub struct EuvNavbarItem {
9    /// The display text.
10    #[get(type(copy))]
11    pub text: &'static str,
12    /// The link target (hash route path or external URL).
13    #[get(type(copy))]
14    pub link: &'static str,
15}
16
17/// Props for the [`euv_navbar`] component.
18///
19/// The trailing actions area (theme toggle, language menu, …) is supplied as
20/// children so callers compose arbitrary controls.
21#[derive(Clone, CustomDebug, Default)]
22pub struct EuvNavbarProps {
23    /// The current route signal (drives the active link highlight).
24    pub route_signal: Signal<String>,
25    /// The brand logo text rendered inside the accent square.
26    pub brand_logo: &'static str,
27    /// The brand title rendered next to the logo.
28    pub brand_title: &'static str,
29    /// The brand home route.
30    pub brand_href: &'static str,
31    /// The navigation links.
32    pub items: &'static [EuvNavbarItem],
33    /// The mobile drawer signal; when `Some` a hamburger button is rendered
34    /// on small viewports and toggles it.
35    pub drawer_open: Option<Signal<bool>>,
36}
37
38/// Props of the [`euv_navbar_link`] component.
39#[derive(Clone, Copy, CustomDebug, Default)]
40pub struct EuvNavbarLinkProps {
41    /// The current route signal.
42    pub route_signal: Signal<String>,
43    /// The navbar item to render.
44    pub item: EuvNavbarItem,
45}