feat: add FrontendLayout component with Header, Footer and Outlet
- New FrontendLayout component wraps all frontend pages with shared Header (with nav items and theme toggle) and Footer - Uses Outlet::<Route> to render child route components - Similar pattern to existing AdminLayout but without auth checks - Registered in components/mod.rs This is the first step toward eliminating page transition flicker by keeping Header/Footer mounted while only the main content area swaps.
This commit is contained in:
parent
778726251a
commit
e861b8a5be
23
src/components/frontend_layout.rs
Normal file
23
src/components/frontend_layout.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::components::footer::Footer;
|
||||
use crate::components::header::Header;
|
||||
use crate::components::nav::use_nav_items;
|
||||
use crate::router::Route;
|
||||
use crate::theme::ThemeToggle;
|
||||
|
||||
#[component]
|
||||
pub fn FrontendLayout() -> Element {
|
||||
let route = use_route::<Route>();
|
||||
let nav_items = use_nav_items(route);
|
||||
|
||||
rsx! {
|
||||
div { class: "min-h-screen flex flex-col bg-white dark:bg-[#1d1e20] transition-colors duration-300",
|
||||
Header { nav_items, right_content: rsx! { ThemeToggle {} } }
|
||||
main { class: "flex-1 w-full max-w-3xl mx-auto px-6 py-6",
|
||||
Outlet::<Route> {}
|
||||
}
|
||||
Footer {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
pub mod admin_layout;
|
||||
pub mod admin_skeleton;
|
||||
pub mod footer;
|
||||
pub mod frontend_layout;
|
||||
pub mod header;
|
||||
pub mod nav;
|
||||
pub mod page_layout;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user