yggdrasil/components/
nav.rs1use crate::components::header::NavItemConfig;
6use crate::router::Route;
7
8pub fn use_nav_items(route: Route) -> Vec<NavItemConfig> {
16 vec![
17 NavItemConfig {
18 route: Route::Home {},
19 label: "首页",
20 is_active: matches!(route, Route::Home {}),
21 },
22 NavItemConfig {
23 route: Route::Archives {},
24 label: "归档",
25 is_active: matches!(route, Route::Archives {}),
26 },
27 NavItemConfig {
28 route: Route::Tags {},
29 label: "标签",
30 is_active: matches!(route, Route::Tags {}) || matches!(route, Route::TagDetail { .. }),
31 },
32 NavItemConfig {
33 route: Route::Friends {},
34 label: "友链",
35 is_active: matches!(route, Route::Friends {}),
36 },
37 NavItemConfig {
38 route: Route::About {},
39 label: "关于",
40 is_active: matches!(route, Route::About {}),
41 },
42 ]
43}