docsite.rsx 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. pub(crate) fn Nav() -> Element {
  2. rsx! {
  3. SearchModal {}
  4. header {
  5. class: "sticky top-0 z-30 bg-white dark:text-gray-200 dark:bg-ideblack border-b dark:border-stone-700 h-16 bg-opacity-80 backdrop-blur-sm",
  6. class: if HIGHLIGHT_NAV_LAYOUT() { "border border-orange-600 rounded-md" },
  7. div { class: "lg:py-2 px-2 max-w-screen-2xl mx-auto flex items-center justify-between text-sm leading-6 h-16",
  8. button {
  9. class: "bg-gray-100 rounded-lg p-2 mr-4 lg:hidden my-3 h-10 flex items-center text-lg z-[100]",
  10. class: if !SHOW_DOCS_NAV() { "hidden" },
  11. onclick: move |_| {
  12. let mut sidebar = SHOW_SIDEBAR.write();
  13. *sidebar = !*sidebar;
  14. },
  15. MaterialIcon {
  16. name: "menu",
  17. size: 24,
  18. color: MaterialIconColor::Dark,
  19. }
  20. }
  21. div { class: "flex z-50 md:flex-1 px-2", LinkList {} }
  22. div { class: "hidden md:flex h-full justify-end ml-2 flex-1",
  23. div { class: "hidden md:flex items-center",
  24. Search {}
  25. div { class: "hidden lg:flex items-center border-l border-gray-200 ml-4 pl-4 dark:border-gray-800",
  26. label {
  27. class: "sr-only",
  28. id: "headlessui-listbox-label-2",
  29. "Theme"
  30. }
  31. Link {
  32. to: "https://discord.gg/XgGxMSkvUM",
  33. class: "block text-gray-400 hover:text-gray-500 dark:hover:text-gray-300",
  34. new_tab: true,
  35. span { class: "sr-only", "Dioxus on Discord" }
  36. crate::icons::DiscordLogo {}
  37. }
  38. Link {
  39. to: "https://github.com/dioxuslabs/dioxus",
  40. class: "ml-4 block text-gray-400 hover:text-gray-500 dark:hover:text-gray-300",
  41. new_tab: true,
  42. span { class: "sr-only", "Dioxus on GitHub" }
  43. crate::icons::Github2 {}
  44. }
  45. }
  46. div { class: "hidden lg:flex items-center border-l border-gray-200 ml-4 pl-6 dark:border-gray-800",
  47. label {
  48. class: "sr-only",
  49. id: "headlessui-listbox-label-2",
  50. "Theme"
  51. }
  52. Link {
  53. to: Route::Deploy {},
  54. class: "md:ml-0 md:py-2 md:px-3 bg-blue-500 ml-4 text-lg md:text-sm text-white rounded font-semibold",
  55. "DEPLOY"
  56. }
  57. if LOGGED_IN() {
  58. Link { to: Route::Homepage {},
  59. img {
  60. src: "https://avatars.githubusercontent.com/u/10237910?s=40&v=4",
  61. class: "ml-4 h-10 rounded-full w-auto",
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. #[component]
  73. fn SidebarSection(chapter: &'static SummaryItem<BookRoute>) -> Element {
  74. let link = chapter.maybe_link()?;
  75. let sections = link.nested_items.iter().map(|chapter| {
  76. rsx! {
  77. SidebarChapter { chapter }
  78. }
  79. });
  80. let _ = rsx! {
  81. SidebarChapter { chapter }
  82. };
  83. rsx! {
  84. SidebarChapter { chapter }
  85. };
  86. rsx! {
  87. div {}
  88. };
  89. rsx! { "hi" }
  90. rsx! {
  91. div { class: "full-chapter pb-4 mb-6",
  92. if let Some(url) = &link.location {
  93. Link {
  94. onclick: move |_| *SHOW_SIDEBAR.write() = false,
  95. to: Route::Docs { child: *url },
  96. h3 { class: "font-semibold mb-4", "{link.name}" }
  97. }
  98. }
  99. ul { class: "ml-1", {sections} }
  100. }
  101. }
  102. }