basic.rs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //! basic example that renders a simple domtree to the page :)
  2. //!
  3. //!
  4. //!
  5. use dioxus_core::prelude::bumpalo::Bump;
  6. use dioxus_core::prelude::*;
  7. use dioxus_web::*;
  8. fn main() {
  9. wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
  10. log::debug!("Hello world, from the app");
  11. WebsysRenderer::simple_render(html! {
  12. // Body
  13. <div class="flex items-center justify-center flex-col">
  14. <div class="flex items-center justify-center">
  15. <div class="flex flex-col bg-white rounded p-4 w-full max-w-xs">
  16. // Title
  17. <div class="font-bold text-xl">
  18. // {format!("Fibonacci Calculator: n = {}",n)}
  19. "Fibonacci Calculator: n = {}"
  20. </div>
  21. // Subtext / description
  22. <div class="text-sm text-gray-500">
  23. // {format!("Calculated in {} nanoseconds",duration)}
  24. // {format!("Calculated in {} nanoseconds",duration)}
  25. "Calculated in {} nanoseconds"
  26. </div>
  27. <div class="flex flex-row items-center justify-center mt-6">
  28. // Main number
  29. <div class="font-medium text-6xl">
  30. // {format!("{}",fib_n)}
  31. </div>
  32. </div>
  33. // Try another
  34. <div class="flex flex-row justify-between mt-6">
  35. // <a href=format!("http://localhost:8080/fib/{}", other_fib_to_try) class="underline">
  36. "Click to try another number"
  37. // {"Click to try another number"}
  38. // </a>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. });
  44. }