borderless.rs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // window.set_fullscreen(true);
  10. cx.render(rsx!(
  11. link { href:"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css", rel:"stylesheet" }
  12. header {
  13. class: "text-gray-400 bg-gray-900 body-font",
  14. onmousedown: move |_| window.drag(),
  15. div {
  16. class: "container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center",
  17. a { class: "flex title-font font-medium items-center text-white mb-4 md:mb-0",
  18. span { class: "ml-3 text-xl", "Dioxus"}
  19. }
  20. nav { class: "md:ml-auto flex flex-wrap items-center text-base justify-center" }
  21. button {
  22. 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",
  23. onmousedown: |evt| evt.cancel_bubble(),
  24. onclick: move |_| window.set_minimized(true),
  25. "Minimize"
  26. }
  27. button {
  28. 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",
  29. onmousedown: |evt| evt.cancel_bubble(),
  30. onclick: move |_| window.close(),
  31. "Close"
  32. }
  33. }
  34. }
  35. ))
  36. }