tailwind.rs 5.1 KB

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