basic.rs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. "Jon's awesome site!!11"
  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. "He worked so hard on it :)"
  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. "1337"
  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. "Legit made my own React"
  37. // </a>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. });
  43. }