euv_ui/component/router/view/struct.rs
1use crate::*;
2
3/// Props for the `euv_page_router` component.
4///
5/// Defines the strongly-typed interface for a page router that
6/// renders different content based on the current route.
7#[derive(Clone, CustomDebug, Default)]
8pub struct EuvPageRouterProps {
9 /// The reactive signal holding the current route.
10 pub route_signal: Signal<String>,
11 /// The default/fallback view when no route matches.
12 #[debug(skip)]
13 pub fallback: Option<Rc<dyn Fn() -> VirtualNode>>,
14}
15
16/// Configuration for a route entry in the router.
17#[derive(Clone, CustomDebug)]
18pub struct EuvRouteConfig {
19 /// The route path to match.
20 pub path: &'static str,
21 /// The component to render for this route.
22 #[debug(skip)]
23 pub component: Rc<dyn Fn() -> VirtualNode>,
24}
25
26/// Props for declarative route-based rendering.
27#[derive(Clone, CustomDebug, Default)]
28pub struct EuvRoutesProps {
29 /// The reactive signal holding the current route.
30 pub route_signal: Signal<String>,
31 /// The list of route configurations.
32 pub routes: Vec<EuvRouteConfig>,
33 /// Optional fallback component when no route matches.
34 #[debug(skip)]
35 pub fallback: Option<Rc<dyn Fn() -> VirtualNode>>,
36}