1
0

loading.rs 737 B

1234567891011121314151617181920212223242526272829303132
  1. use dioxus::prelude::*;
  2. #[component]
  3. pub(crate) fn ChildrenOrLoading(children: Element) -> Element {
  4. rsx! {
  5. document::Link {
  6. rel: "stylesheet",
  7. href: asset!("/public/loading.css")
  8. }
  9. SuspenseBoundary {
  10. fallback: |context: SuspenseContext| {
  11. rsx! {
  12. if let Some(placeholder) = context.suspense_placeholder() {
  13. {placeholder}
  14. } else {
  15. LoadingIndicator {}
  16. }
  17. }
  18. },
  19. {children}
  20. }
  21. }
  22. }
  23. #[component]
  24. fn LoadingIndicator() -> Element {
  25. rsx! {
  26. div {
  27. class: "spinner",
  28. }
  29. }
  30. }