From f07e345eb2a2e4197270396dffebc85c65272fe0 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 24 Sep 2021 01:26:16 -0400 Subject: [PATCH] examples: slightly simplify crm --- packages/web/examples/crm2.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/web/examples/crm2.rs b/packages/web/examples/crm2.rs index 77224fab3..47cd1f435 100644 --- a/packages/web/examples/crm2.rs +++ b/packages/web/examples/crm2.rs @@ -12,21 +12,7 @@ fn main() { wasm_logger::init(wasm_logger::Config::new(log::Level::Debug)); console_error_panic_hook::set_once(); - // Run the app - static WrappedApp: FC<()> = |cx, _| { - rsx!(cx, body { - link { - rel: "stylesheet" - href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css" - integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5" - crossorigin: "anonymous" - } - margin_left: "35%" - h1 {"Dioxus CRM Example"} - App {} - }) - }; - dioxus_web::launch(WrappedApp, |c| c) + dioxus_web::launch(App, |c| c) } enum Scene { @@ -50,7 +36,7 @@ static App: FC<()> = |cx, _| { let lastname = use_state(cx, || String::new()); let description = use_state(cx, || String::new()); - match *scene { + let scene = match *scene { Scene::ClientsList => { rsx!(cx, div { class: "crm" h2 { "List of clients" margin_bottom: "10px" } @@ -111,5 +97,17 @@ static App: FC<()> = |cx, _| { } }) } - } + }; + + rsx!(cx, body { + link { + rel: "stylesheet" + href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css" + integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5" + crossorigin: "anonymous" + } + margin_left: "35%" + h1 {"Dioxus CRM Example"} + {scene} + }) };