nova_forms/components/
nova_form_wrapper.rs1use leptos::*;
2use leptos_meta::*;
3
4use crate::AppContext;
5
6#[component]
9pub fn NovaFormWrapper(
10 #[prop(into)] logo: String,
12 #[prop(into)] title: TextProp,
14 #[prop(into, optional)] subtitle: Option<TextProp>,
16 #[prop(into, optional)] footer: Option<Children>,
19 children: Children,
21) -> impl IntoView {
22 let base_context = expect_context::<AppContext>();
23
24 view! {
25 <Title text={title.clone()} />
26
27 <header>
28 <div class="content">
29 <img id="logo" src=base_context.resolve_path(logo) />
30 <div id="name">
31 <span id="title">{title.clone()}</span>
32 {if let Some(subtitle) = subtitle {
33 view! {
34 <br />
35 <span id="subtitle">{subtitle}</span>
36 }.into_view()
37 } else {
38 View::default()
39 }}
40 </div>
41 </div>
42 </header>
43 <main>
44 <div class="content">
45 {children()}
46 </div>
47 </main>
48 {
49 if let Some(footer) = footer {
50 view! {
51 <footer>
52 <div class="content">
53 <span>{footer()}</span>
54 </div>
55 </footer>
56 }.into_view()
57 } else {
58 View::default()
59 }
60 }
61
62 }
63}