prop_rsx.rsx 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. fn AvailablePlatforms() -> Element {
  2. rsx! {
  3. section { class: "w-full dark:bg-ideblack",
  4. div { class: "container mx-auto max-w-screen-lg",
  5. div { class: "relative overflow-x-hidden",
  6. div { class: "flex flex-col items-center justify-center text-center max-w-screen-lg mx-auto pb-4",
  7. h1 { class: "text-[3.3em] font-bold tracking-tight dark:text-white text-ghdarkmetal pb-4 mb-4 ",
  8. "One codebase, every platform."
  9. }
  10. p { class: "text-xl text-gray-600 dark:text-gray-400 pb-4 max-w-screen-sm",
  11. "Dioxus is a React-inspired library for Rust focused on developer experience. Build fast, beautiful, and fully-featured apps for every platform in less time."
  12. }
  13. }
  14. snippets::Snippets {}
  15. }
  16. }
  17. div { class: "max-w-screen-lg mx-auto pb-8 px-2 md:px-16 dark:text-white",
  18. // div { class: "max-w-screen-xl mx-auto pb-64 px-16 dark:text-white",
  19. TriShow {
  20. left: None,
  21. center: None,
  22. right: rsx! { "Build for the web using Rust and WebAssembly. As fast as SolidJS and more robust than React. Integrated hot reloading for instant iterations." },
  23. to: Route::Docs {
  24. child: BookRoute::GettingStartedIndex {},
  25. },
  26. title: "Web with WASM",
  27. }
  28. TriShow {
  29. left: None,
  30. center: None,
  31. right: rsx! { "Lightweight (<2mb) desktop and mobile apps with zero configuration. Choose between WebView or WGPU-enabled renderers. Runs on macOS, Windows, Linux, iOS, and Android." },
  32. to: Route::Docs {
  33. child: BookRoute::GettingStartedIndex {},
  34. },
  35. title: "Desktop and Mobile",
  36. }
  37. TriShow {
  38. to: Route::Docs {
  39. child: BookRoute::GettingStartedIndex {},
  40. },
  41. title: "Terminal User Interfaces",
  42. right: rsx! { "Quickly convert any CLI tool to a beautiful interactive user interface with just a few lines of code. Runs anywhere with a terminal." },
  43. left: None,
  44. center: None,
  45. }
  46. TriShow {
  47. to: Route::Docs {
  48. child: BookRoute::GettingStartedIndex {},
  49. },
  50. title: "Fullstack Apps",
  51. right: rsx! { "Pre-render on the server, and hydrate on the client. Perfect lighthouse scores and performance over 1000x better than Node and Python. Perfect for static site generation or fullstack apps." },
  52. left: None,
  53. center: None,
  54. }
  55. TriShow {
  56. to: Route::Docs {
  57. child: BookRoute::GettingStartedIndex {},
  58. },
  59. title: "LiveView",
  60. right: rsx! { "Render your app entirely on the server. Zero backend configuration capable of handling thousands of active clients." },
  61. left: None,
  62. center: None,
  63. last: true,
  64. }
  65. }
  66. }
  67. }
  68. }
  69. #[component]
  70. fn TriShow(
  71. left: Element,
  72. center: Element,
  73. right: Element,
  74. title: &'static str,
  75. to: Route,
  76. last: Option<bool>,
  77. ) -> Element {
  78. rsx! {
  79. div { class: "w-full flex flex-row justify-center max-w-screen-lg",
  80. // div { class: "grow basis-0", left }
  81. TriPadding { last: last.unwrap_or_default(), {center} }
  82. div { class: "grow basis-0",
  83. Link { to: to.clone(),
  84. div { class: "min-w-lg max-w-screen-md hover:shadow-pop rounded-lg p-8",
  85. h2 { class: "text-2xl text-gray-800 font-semibold pb-2 dark:text-gray-100 ",
  86. "{title}"
  87. }
  88. {right}
  89. }
  90. }
  91. }
  92. }
  93. }
  94. }
  95. #[component]
  96. fn TriPadding(children: Element, last: bool) -> Element {
  97. rsx!(
  98. div { class: "flex flex-col items-center",
  99. div { class: "w-0 h-10 border-dashed border border-[#444]" }
  100. IconSplit {}
  101. if !last {
  102. div { class: "w-0 h-full border-dashed border border-[#444]", {children} }
  103. }
  104. }
  105. )
  106. }
  107. #[component]
  108. fn DeveloperExperience() -> Element {
  109. rsx! (
  110. section { class: "pt-36 w-full dark:bg-ideblack dark:text-white",
  111. div { class: "container mx-auto max-w-screen-2xl",
  112. div { class: "relative",
  113. div { class: "flex flex-col max-w-screen-lg mx-auto pb-20",
  114. h1 { class: "text-[3.3em] font-bold tracking-tight items-center justify-center text-center dark:text-white text-ghdarkmetal pb-4 mb-4 ",
  115. "Redefining developer experience."
  116. }
  117. div { class: "flex flex-row",
  118. p { class: "text-xl text-gray-600 dark:text-gray-400 pb-4 max-w-screen-sm w-1/2",
  119. "Dioxus is a React-inspired library for Rust that empowers you to quickly build fast, beautiful, and fully-featured apps for every platform."
  120. }
  121. p { class: "text-xl text-gray-600 dark:text-gray-400 pb-4 max-w-screen-sm w-1/2",
  122. "Dioxus is a React-inspired library for Rust that empowers you to quickly build fast, beautiful, and fully-featured apps for every platform."
  123. }
  124. }
  125. }
  126. div { class: "max-w-screen-2xl mx-auto flex flex-row",
  127. div { class: "w-1/2" }
  128. div { class: "w-1/2",
  129. ExperienceText {
  130. title: "Integrated Devtools",
  131. content: "Hot reloading for instant iteration, automatic code formatting, convert HTML to RSX, and more.",
  132. }
  133. ExperienceText {
  134. title: "Minimal configuration",
  135. content: "Start projects with `cargo new`. No build scripts or configuration required for development.",
  136. }
  137. ExperienceText {
  138. title: "",
  139. content: "Strong typing with no runtime overhead. Automatically derive props, forms, API clients, and more.",
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. )
  147. }
  148. #[component]
  149. fn ExperienceText(title: &'static str, content: &'static str) -> Element {
  150. rsx!(
  151. div { class: "pb-12",
  152. h3 { class: "text-2xl text-gray-800 font-semibold pb-2 dark:text-gray-100 ",
  153. "{title}"
  154. }
  155. p { "{content}" }
  156. }
  157. )
  158. }
  159. fn IconSplit() -> Element {
  160. rsx! {
  161. svg {
  162. class: "mx-auto fill-[#444] dark:fill-white",
  163. version: "1.1",
  164. view_box: "0 0 24 24",
  165. width: "24",
  166. "data-view-component": "true",
  167. "aria-hidden": "true",
  168. height: "24",
  169. path {
  170. stroke_width: "1.5",
  171. fill_rule: "evenodd",
  172. d: "M15.5 11.75a3.5 3.5 0 11-7 0 3.5 3.5 0 017 0zm1.444-.75a5.001 5.001 0 00-9.888 0H2.75a.75.75 0 100 1.5h4.306a5.001 5.001 0 009.888 0h4.306a.75.75 0 100-1.5h-4.306z",
  173. }
  174. }
  175. }
  176. }
  177. fn Stats() -> Element {
  178. rsx! {
  179. section { class: "py-12 w-full dark:bg-ideblack",
  180. div { class: "container mx-auto max-w-screen-lg",
  181. div { class: "relative ",
  182. div { class: "flex flex-col items-center justify-center text-center max-w-screen-lg mx-auto pb-4",
  183. // span { class: "text-xl text-blue-300", "Portable" }
  184. h1 { class: "text-[3.3em] font-bold tracking-tight dark:text-white text-ghdarkmetal pb-4 mb-4 ",
  185. "A vibrant, active community."
  186. }
  187. p { class: "text-xl text-gray-600 dark:text-gray-400 pb-4 max-w-screen-sm",
  188. "Driven by a large, active, and welcoming community."
  189. }
  190. }
  191. }
  192. }
  193. div { class: "max-w-screen-xl mx-auto py-12 px-2 md:px-16 dark:bg-[#111111] mb-12",
  194. div { class: "grid grid-cols-2 grid-rows-2 sm:grid-cols-4 sm:grid-rows-1",
  195. StatsItem { major: "16k", minor: "Stars" }
  196. StatsItem { major: "140k", minor: "Downloads" }
  197. StatsItem { major: "206", minor: "Contributors" }
  198. StatsItem { major: "1500", minor: "Community Projects" }
  199. }
  200. }
  201. a { href: "https://github.com/dioxuslabs/dioxus/graphs/contributors",
  202. img {
  203. src: "https://contrib.rocks/image?repo=dioxuslabs/dioxus&max=52&columns=13",
  204. class: "mx-auto pb-12",
  205. alt: "Dioxus Contributors",
  206. }
  207. }
  208. }
  209. }
  210. }
  211. #[component]
  212. fn StatsItem(major: &'static str, minor: &'static str) -> Element {
  213. rsx! {
  214. div { class: "text-center shadow mx-2 rounded-lg py-6 border",
  215. div { class: "text-5xl font-bold text-gray-800 dark:text-gray-100", {major} }
  216. div { class: "text-xl text-gray-600 dark:text-gray-400", {minor} }
  217. }
  218. }
  219. }