tailwind.rs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. use dioxus::desktop::wry::application::platform::macos::*;
  2. use dioxus::prelude::*;
  3. fn main() {
  4. dioxus::desktop::launch(App, |c| {
  5. c.with_fullsize_content_view(true)
  6. .with_titlebar_buttons_hidden(false)
  7. .with_titlebar_transparent(true)
  8. .with_movable_by_window_background(true)
  9. });
  10. }
  11. const STYLE: &str = "body {overflow:hidden;}";
  12. pub const App: FC<()> = |cx| {
  13. cx.render(rsx!(
  14. div { class: "overflow-hidden"
  15. style { "{STYLE}" }
  16. link { href:"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel:"stylesheet" }
  17. Header {}
  18. Entry {}
  19. Hero {}
  20. Hero {}
  21. Hero {}
  22. Hero {}
  23. Hero {}
  24. }
  25. ))
  26. };
  27. pub const Header: FC<()> = |cx| {
  28. cx.render(rsx! {
  29. div {
  30. header { class: "text-gray-400 bg-gray-900 body-font"
  31. div { class: "container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center"
  32. a { class: "flex title-font font-medium items-center text-white mb-4 md:mb-0"
  33. StacksIcon {}
  34. span { class: "ml-3 text-xl" "Hello Dioxus!"}
  35. }
  36. nav { class: "md:ml-auto flex flex-wrap items-center text-base justify-center"
  37. a { class: "mr-5 hover:text-white" "First Link"}
  38. a { class: "mr-5 hover:text-white" "Second Link"}
  39. a { class: "mr-5 hover:text-white" "Third Link"}
  40. a { class: "mr-5 hover:text-white" "Fourth Link"}
  41. }
  42. button {
  43. 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"
  44. "Button"
  45. RightArrowIcon {}
  46. }
  47. }
  48. }
  49. }
  50. })
  51. };
  52. pub const Hero: FC<()> = |cx| {
  53. //
  54. cx.render(rsx! {
  55. section{ class: "text-gray-400 bg-gray-900 body-font"
  56. div { class: "container mx-auto flex px-5 py-24 md:flex-row flex-col items-center"
  57. div { class: "lg:flex-grow md:w-1/2 lg:pr-24 md:pr-16 flex flex-col md:items-start md:text-left mb-16 md:mb-0 items-center text-center"
  58. h1 { class: "title-font sm:text-4xl text-3xl mb-4 font-medium text-white"
  59. br { class: "hidden lg:inline-block" }
  60. "Dioxus Sneak Peek"
  61. }
  62. p {
  63. class: "mb-8 leading-relaxed"
  64. "Dioxus is a new UI framework that makes it easy and simple to write cross-platform apps using web
  65. technologies! It is functional, fast, and portable. Dioxus can run on the web, on the desktop, and
  66. on mobile and embedded platforms."
  67. }
  68. div { class: "flex justify-center"
  69. button {
  70. class: "inline-flex text-white bg-indigo-500 border-0 py-2 px-6 focus:outline-none hover:bg-indigo-600 rounded text-lg"
  71. "Learn more"
  72. }
  73. button {
  74. class: "ml-4 inline-flex text-gray-400 bg-gray-800 border-0 py-2 px-6 focus:outline-none hover:bg-gray-700 hover:text-white rounded text-lg"
  75. "Build an app"
  76. }
  77. }
  78. }
  79. div { class: "lg:max-w-lg lg:w-full md:w-1/2 w-5/6"
  80. img { class: "object-cover object-center rounded" alt: "hero" src: "https://i.imgur.com/oK6BLtw.png"
  81. referrerpolicy:"no-referrer"
  82. }
  83. }
  84. }
  85. }
  86. })
  87. };
  88. pub const Entry: FC<()> = |cx| {
  89. //
  90. cx.render(rsx! {
  91. section{ class: "text-gray-400 bg-gray-900 body-font"
  92. div { class: "container mx-auto flex px-5 py-24 md:flex-row flex-col items-center"
  93. textarea {
  94. }
  95. }
  96. }
  97. })
  98. };
  99. pub const StacksIcon: FC<()> = |cx| {
  100. cx.render(rsx!(
  101. svg {
  102. // xmlns: "http://www.w3.org/2000/svg"
  103. fill: "none"
  104. stroke: "currentColor"
  105. stroke_linecap: "round"
  106. stroke_linejoin: "round"
  107. stroke_width: "2"
  108. class: "w-10 h-10 text-white p-2 bg-indigo-500 rounded-full"
  109. viewBox: "0 0 24 24"
  110. path { d: "M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"}
  111. }
  112. ))
  113. };
  114. pub const RightArrowIcon: FC<()> = |cx| {
  115. cx.render(rsx!(
  116. svg {
  117. fill: "none"
  118. stroke: "currentColor"
  119. stroke_linecap: "round"
  120. stroke_linejoin: "round"
  121. stroke_width: "2"
  122. class: "w-4 h-4 ml-1"
  123. viewBox: "0 0 24 24"
  124. path { d: "M5 12h14M12 5l7 7-7 7"}
  125. }
  126. ))
  127. };