borderless.rs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. use dioxus::prelude::*;
  2. fn main() {
  3. dioxus::desktop::launch_cfg(app, |cfg| {
  4. cfg.with_window(|w| w.with_title("BorderLess Demo").with_decorations(false))
  5. });
  6. }
  7. fn app(cx: Scope) -> Element {
  8. let window = dioxus::desktop::use_window(&cx);
  9. cx.render(rsx!(
  10. link { href:"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css", rel:"stylesheet" }
  11. header {
  12. class: "text-gray-400 bg-gray-900 body-font",
  13. onmousedown: move |_| window.drag(),
  14. div {
  15. class: "container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center",
  16. a { class: "flex title-font font-medium items-center text-white mb-4 md:mb-0",
  17. span { class: "ml-3 text-xl", "Dioxus"}
  18. }
  19. nav { class: "md:ml-auto flex flex-wrap items-center text-base justify-center" }
  20. button {
  21. class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
  22. onmousedown: |evt| evt.cancel_bubble(),
  23. onclick: move |_| window.minimize(true),
  24. "Minimize"
  25. }
  26. button {
  27. class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
  28. onmousedown: |evt| evt.cancel_bubble(),
  29. onclick: move |_| window.close(),
  30. "Close"
  31. }
  32. }
  33. }
  34. ))
  35. }