index.tsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. import { useCallback, useState } from "react";
  2. import clsx from "clsx";
  3. import Link from "next/link";
  4. import ClickAwayListener from "@mui/base/ClickAwayListener";
  5. import logo from "../../../public/logo.svg";
  6. export default function Header() {
  7. const [open, setOpen] = useState(false);
  8. const toggleMenu = useCallback(() => {
  9. setOpen((o) => !o);
  10. }, [setOpen]);
  11. const closeMenu = useCallback(() => {
  12. setOpen(false);
  13. }, [setOpen]);
  14. return (
  15. <header className={clsx("header", { open })}>
  16. <ClickAwayListener onClickAway={closeMenu}>
  17. <div className="container">
  18. <Link href="/">
  19. <a className="logo" title="NovelDit">
  20. {/* eslint-disable-next-line @next/next/no-img-element */}
  21. <img src={logo.src} alt="NovelDit" />
  22. <span>NovelDit</span>
  23. </a>
  24. </Link>
  25. <div className="menu">
  26. <nav>
  27. <ul>
  28. <li>
  29. <a className="menu-item" href="" title="Browse">
  30. <svg width="24" height="24">
  31. <use href="/icons.svg#browse"></use>
  32. </svg>
  33. <strong>Browse</strong>
  34. </a>
  35. <div className="sub-menu">
  36. <ul className="sub-menu-sized">
  37. <li>
  38. <a href="/stories/novel" title="Novels">
  39. Novels
  40. </a>
  41. <div className="sub-menu-list">
  42. <p>
  43. <strong>MALE LEAD</strong>
  44. <a href="/stories/novel-urban-male" title="Urban">
  45. Urban
  46. </a>
  47. <a
  48. href="/stories/novel-eastern-male"
  49. title="Eastern"
  50. >
  51. Eastern
  52. </a>
  53. <a href="/stories/novel-games-male" title="Games">
  54. Games
  55. </a>
  56. <a
  57. href="/stories/novel-fantasy-male"
  58. title="Fantasy"
  59. >
  60. Fantasy
  61. </a>
  62. <a href="/stories/novel-scifi-male" title="Sci-fi">
  63. Sci-fi
  64. </a>
  65. <a href="/stories/novel-acg-male" title="ACG">
  66. ACG
  67. </a>
  68. <a href="/stories/novel-horror-male" title="Horror">
  69. Horror
  70. </a>
  71. <a href="/stories/novel-sports-male" title="Sports">
  72. Sports
  73. </a>
  74. <a href="/stories/novel-action-male" title="Action">
  75. Action
  76. </a>
  77. <a href="/stories/novel-war-male" title="War">
  78. War
  79. </a>
  80. <a
  81. href="/stories/novel-realistic-male"
  82. title="Realistic"
  83. >
  84. Realistic
  85. </a>
  86. <a
  87. href="/stories/novel-history-male"
  88. title="History"
  89. >
  90. History
  91. </a>
  92. </p>
  93. <p>
  94. <strong>FEMALE LEAD</strong>
  95. <a href="/stories/novel-urban-female" title="Urban">
  96. Urban
  97. </a>
  98. <a
  99. href="/stories/novel-fantasy-female"
  100. title="Fantasy"
  101. >
  102. Fantasy
  103. </a>
  104. <a
  105. href="/stories/novel-history-female"
  106. title="History"
  107. >
  108. History
  109. </a>
  110. <a href="/stories/novel-teen-female" title="Teen">
  111. Teen
  112. </a>
  113. <a href="/stories/novel-lgbt-female" title="LGBT+">
  114. LGBT+
  115. </a>
  116. <a
  117. href="/stories/novel-scifi-female"
  118. title="Sci-fi"
  119. >
  120. Sci-fi
  121. </a>
  122. <a
  123. href="/stories/novel-general-female"
  124. title="General"
  125. >
  126. General
  127. </a>
  128. </p>
  129. </div>
  130. </li>
  131. <li>
  132. <a href="/stories/fanfic" title="Fan-fic">
  133. Fan-fic
  134. </a>
  135. <div className="sub-menu-list">
  136. <p>
  137. <a
  138. href="/stories/fanfic-anime-comics"
  139. title="Anime &amp; Comics"
  140. >
  141. Anime &amp; Comics
  142. </a>
  143. <a
  144. href="/stories/fanfic-video-games"
  145. title="Video Games"
  146. >
  147. Video Games
  148. </a>
  149. <a
  150. href="/stories/fanfic-celebrities"
  151. title="Celebrities"
  152. >
  153. Celebrities
  154. </a>
  155. <a
  156. href="/stories/fanfic-music-bands"
  157. title="Music &amp; Bands"
  158. >
  159. Music &amp; Bands
  160. </a>
  161. <a href="/stories/fanfic-movies" title="Movies">
  162. Movies
  163. </a>
  164. <a
  165. href="/stories/fanfic-book-literature"
  166. title="Book&amp;Literature"
  167. >
  168. Book&amp;Literature
  169. </a>
  170. <a href="/stories/fanfic-tv" title="TV">
  171. TV
  172. </a>
  173. <a href="/stories/fanfic-theater" title="Theater">
  174. Theater
  175. </a>
  176. <a href="/stories/fanfic-others" title="Others">
  177. Others
  178. </a>
  179. </p>
  180. </div>
  181. </li>
  182. </ul>
  183. </div>
  184. </li>
  185. <li>
  186. <a className="menu-item" href="" title="Rankings">
  187. <svg viewBox="0 0 1024 1024" width="24" height="24">
  188. <use href="/icons.svg#ranking"></use>
  189. </svg>
  190. <strong>Rankings</strong>
  191. </a>
  192. <div className="sub-menu">
  193. <ul>
  194. <li>
  195. <a
  196. href="/ranking/novel/bi_annual/power_rank?timeType=3&amp;sourceType=2&amp;signStatus=1"
  197. title="Novels ranking"
  198. >
  199. Novels ranking
  200. </a>
  201. </li>
  202. <li>
  203. <a
  204. href="/ranking/comic/all_time/comic_power_rank"
  205. title="Comics ranking"
  206. >
  207. Comics ranking
  208. </a>
  209. </li>
  210. <li>
  211. <a
  212. href="/ranking/fanfic/bi_annual/power_rank"
  213. title="Fan-fic ranking"
  214. >
  215. Fan-fic ranking
  216. </a>
  217. </li>
  218. </ul>
  219. </div>
  220. </li>
  221. </ul>
  222. </nav>
  223. <form action="./search" className="search-input">
  224. <svg className="icon-search">
  225. <use href="/icons.svg#search"></use>
  226. </svg>
  227. <input type="search" name="q" placeholder="Search" />
  228. </form>
  229. </div>
  230. <div className="buttons">
  231. <button className="menu-btn" onClick={toggleMenu}>
  232. <svg
  233. className="icon-menu"
  234. xmlns="http://www.w3.org/2000/svg"
  235. viewBox="0 0 16 16"
  236. >
  237. <rect
  238. x="1"
  239. y="4"
  240. width="14"
  241. height="1.5"
  242. rx="1"
  243. className="r-1"
  244. ></rect>
  245. <rect
  246. x="1"
  247. y="7.25"
  248. width="14"
  249. height="1.5"
  250. rx="1"
  251. className="r-2"
  252. ></rect>
  253. <rect
  254. x="1"
  255. y="10.5"
  256. width="14"
  257. height="1.5"
  258. rx="1"
  259. className="r-3"
  260. ></rect>
  261. </svg>
  262. </button>
  263. </div>
  264. </div>
  265. </ClickAwayListener>
  266. </header>
  267. );
  268. }