|
2 | 2 |
|
3 | 3 | import { useEffect } from "react"; |
4 | 4 | import { usePathname } from "next/navigation"; |
5 | | -import { Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react"; |
6 | | -import { Bars3Icon, BellIcon, XMarkIcon } from "@heroicons/react/24/outline"; |
| 5 | +import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/react"; |
| 6 | +import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline"; |
7 | 7 | import { ProfileLogoSVG, HomeWithTextIcon, BlogWithTextIcon, TopicWithTextIcon, HeptagoningWithTextIcon, ResearchWithTextIcon } from "@/app/_components/main_frame/icons_svg"; |
8 | 8 | import { useNavigation } from "@/app/_components/main_frame/navigation-context"; |
9 | 9 | import { TKOKHING_LOGO_SVG_URL } from "@/lib/share/constants"; |
@@ -69,7 +69,7 @@ export default function Navigationbar() { |
69 | 69 | return ( |
70 | 70 | <div className="min-h-full"> |
71 | 71 | <Disclosure as="nav" className="mt-3 mb-16 md:mb-12"> |
72 | | - <div className="container mx-auto px-5 sm:px-6 lg:px-8 "> |
| 72 | + <div className="container mx-auto px-5 sm:px-6 lg:px-8 relative"> |
73 | 73 | <div className="flex h-16 items-center justify-between"> |
74 | 74 | <div className="flex items-center"> |
75 | 75 | <div className="shrink-0 flex size-28"> |
@@ -115,25 +115,46 @@ export default function Navigationbar() { |
115 | 115 | </div> |
116 | 116 | </div> |
117 | 117 | <DisclosurePanel className="md:hidden"> |
118 | | - <div className="border-t border-gray-700 pb-3 pt-4 items-center flex flex-row justify-around"> |
119 | | - <ThemeSwitcher /> |
120 | | - <FontSizeDropdown /> |
121 | | - </div> |
122 | | - <div className="space-y-1 px-2 pb-3 pt-2 sm:px-3"> |
123 | | - {navigation.map((item) => ( |
124 | | - <DisclosureButton |
125 | | - key={item.name} |
126 | | - as="a" |
127 | | - href={item.href} |
128 | | - aria-current={selected === item.name ? 'page' : undefined} |
129 | | - className={classNames( |
130 | | - selected === item.name ? 'bg-gray-700 dark:bg-gray-600' : 'text-sky-800 hover:bg-gray-500', |
131 | | - 'block rounded-md px-3 py-2' |
132 | | - )} |
133 | | - > |
134 | | - <item.icon aria-hidden="true" /> |
135 | | - </DisclosureButton> |
136 | | - ))} |
| 118 | + {/* blur out backdrop */} |
| 119 | + <div className="fixed inset-0 z-40 bg-black/40 backdrop-blur-sm" /> |
| 120 | + {/* Drawer panel */} |
| 121 | + <div className="absolute origin-top-right right-5 sm:right-6 lg:right-8 z-50 h-full w-[80%] max-w-sm"> |
| 122 | + {/* separate shading which cannot be absolute, resizing will failed*/} |
| 123 | + <div className="bg-white dark:bg-zinc-900 border-1 border-gray-300 dark:border-zinc-700 shadow-2xl transition-transform duration-300"> |
| 124 | + {/* Top Controls */} |
| 125 | + <div className="flex items-center justify-between p-4 border-b border-gray-300 dark:border-zinc-700"> |
| 126 | + <span className="font-semibold">Menu</span> |
| 127 | + <DisclosureButton |
| 128 | + className="group relative inline-flex items-center justify-center rounded-md bg-gray-800 p-2 text-gray-400 hover:bg-gray-700 hover:text-tkokhing-blue hover:dark:text-tkokhing-dark focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800" |
| 129 | + aria-label="Open Main Menu" |
| 130 | + > |
| 131 | + <span className="absolute -inset-0.5" /> |
| 132 | + <XMarkIcon aria-hidden="true" className="size-6 group-data-[open]:block" /> |
| 133 | + </DisclosureButton> |
| 134 | + </div> |
| 135 | + {/* Settings */} |
| 136 | + <div className="flex justify-around py-4 border-b border-gray-200 dark:border-zinc-700"> |
| 137 | + <ThemeSwitcher /> |
| 138 | + <FontSizeDropdown /> |
| 139 | + </div> |
| 140 | + {/* Navigation */} |
| 141 | + <div className="space-y-2 px-4 py-4"> |
| 142 | + {navigation.map((item) => ( |
| 143 | + <DisclosureButton |
| 144 | + key={item.name} |
| 145 | + as="a" |
| 146 | + href={item.href} |
| 147 | + aria-current={selected === item.name ? 'page' : undefined} |
| 148 | + className={classNames( |
| 149 | + selected === item.name ? 'bg-gray-700 dark:bg-gray-600' : 'text-sky-800 hover:bg-gray-500', |
| 150 | + 'block rounded-md px-3 py-2' |
| 151 | + )} |
| 152 | + > |
| 153 | + <item.icon aria-hidden="true" /> |
| 154 | + </DisclosureButton> |
| 155 | + ))} |
| 156 | + </div> |
| 157 | + </div> |
137 | 158 | </div> |
138 | 159 | </DisclosurePanel> |
139 | 160 | </Disclosure> |
|
0 commit comments