Guest User

Untitled

a guest
May 3rd, 2024
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. import {
  2. Navbar as NextUINavbar,
  3. NavbarContent,
  4. NavbarMenu,
  5. NavbarMenuToggle,
  6. NavbarItem,
  7. NavbarMenuItem,
  8. } from "@nextui-org/navbar";
  9. import { Input } from "@nextui-org/react";
  10. import { Link } from "@nextui-org/link";
  11. import { siteConfig } from "@/config/site";
  12. import NextLink from "next/link";
  13. import clsx from "clsx";
  14. import { User } from "@nextui-org/react";
  15. import { getUser } from "./../server/utils/auth";
  16. import { SearchIcon, SmallLogo } from "@/components/icons";
  17.  
  18. export const Navbar = async () => {
  19. const user = await getUser();
  20.  
  21. return (
  22. <NextUINavbar
  23. maxWidth="xl"
  24. position="sticky"
  25. className="bg-transparent blur-none backdrop-blur-none"
  26. >
  27. <NavbarContent className="flex justify-between items-center mx-4">
  28. <ul className="hidden lg:flex gap-16 uppercase justify-start center">
  29. {siteConfig.navItems.map((item) => (
  30. <NavbarItem key={item.href}>
  31. <NextLink
  32. className={`${clsx(
  33. "font-clean",
  34. "data-[active=true]:text-opacity-100 data-[active=true]:font-medium",
  35. "rounded-md p-2 transition-colors duration-800",
  36. "text-white",
  37. "text-opacity-60",
  38. "text-base",
  39. "font-semibold",
  40. "uppercase",
  41. "tracking-widest",
  42. "hover:text-opacity-80"
  43. )}`}
  44. href={item.href}
  45. >
  46. {item.label}
  47. </NextLink>
  48. </NavbarItem>
  49. ))}
  50. </ul>
  51. <div className="flex items-center">
  52. <Input
  53. classNames={{
  54. base: "max-w-full h-10 w-52 mx-8",
  55. mainWrapper: "h-full",
  56. input: "text-small",
  57. inputWrapper:
  58. "h-full font-normal text-default-500 bg-default-400/20 dark:bg-default-500/20 bg-transparent",
  59. }}
  60. placeholder="SEARCH"
  61. size="md"
  62. startContent={
  63. <SearchIcon size={18} width={undefined} height={undefined} />
  64. }
  65. type="search"
  66. style={{
  67. fontWeight: "500",
  68. fontFamily: "Nunito Sans 7pt",
  69. }}
  70. />
  71.  
  72. {user ? (
  73. <NavbarItem className="mx-16">
  74. <a href="/profile" className="cursor-pointer">
  75. <User
  76. isFocusable
  77. name={user.username}
  78. description={user.rank}
  79. avatarProps={{
  80. src: user.avatar,
  81. }}
  82. />
  83. </a>
  84. </NavbarItem>
  85. ) : (
  86. <NavbarItem className="">
  87. <NextLink href="/login">
  88. <button
  89. className={`${clsx(
  90. "cursor-pointer",
  91. "font-clean",
  92. "text-white",
  93. "text-opacity-60",
  94. "text-base",
  95. "font-semibold",
  96. "uppercase",
  97. "tracking-widest",
  98. "hover:text-opacity-80"
  99. )}`}
  100. >
  101. Login
  102. </button>
  103. </NextLink>
  104. <NextLink href="/register">
  105. <button
  106. className={`${clsx(
  107. "cursor-pointer mx-8",
  108. "font-clean",
  109. "text-white",
  110. "text-opacity-60",
  111. "text-base",
  112. "font-semibold",
  113. "uppercase",
  114. "tracking-widest",
  115. "hover:text-opacity-80"
  116. )}`}
  117. >
  118. Register
  119. </button>
  120. </NextLink>
  121. </NavbarItem>
  122. )}
  123. </div>
  124. </NavbarContent>
  125.  
  126. <NavbarContent className="sm:hidden basis-1 pl-4" justify="end">
  127. <NavbarMenuToggle />
  128. </NavbarContent>
  129.  
  130. <NavbarMenu>
  131. <div className="mx-4 mt-2 flex flex-col gap-6">
  132. {siteConfig.navMenuItems.map((item, index) => (
  133. <NavbarMenuItem key={`${item}-${index}`}>
  134. <Link
  135. color="foreground"
  136. href="#"
  137. size="lg"
  138. style={{
  139. fontFamily: "Nunito Sans 7pt",
  140. }}
  141. >
  142. {item.label}
  143. </Link>
  144. </NavbarMenuItem>
  145. ))}
  146. </div>
  147. </NavbarMenu>
  148. </NextUINavbar>
  149. );
  150. };
  151.  
Advertisement
Add Comment
Please, Sign In to add comment