header.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { Lifebuoy } from "@phosphor-icons/react/dist/ssr/Lifebuoy";
  2. import { Button } from "@pythnetwork/component-library/Button";
  3. import { Link } from "@pythnetwork/component-library/Link";
  4. import clsx from "clsx";
  5. import type { ComponentProps } from "react";
  6. import styles from "./header.module.scss";
  7. import Logo from "./logo.svg";
  8. import { MobileMenu } from "./mobile-menu";
  9. import { SearchButton, SearchShortcutText } from "./search-button";
  10. import { SupportDrawer } from "./support-drawer";
  11. import { MainNavTabs } from "./tabs";
  12. import { ThemeSwitch } from "./theme-switch";
  13. type Props = ComponentProps<"header"> & {
  14. tabs: ComponentProps<typeof MainNavTabs>["items"];
  15. };
  16. export const Header = ({ className, tabs, ...props }: Props) => (
  17. <header className={clsx(styles.header, className)} {...props}>
  18. <div className={styles.content}>
  19. <div className={styles.leftMenu}>
  20. <Link href="/" className={styles.logoLink ?? ""}>
  21. <div className={styles.logoWrapper}>
  22. <Logo className={styles.logo} />
  23. </div>
  24. <div className={styles.logoLabel}>Pyth Homepage</div>
  25. </Link>
  26. <div className={styles.appName}>Insights</div>
  27. <MainNavTabs className={styles.mainNavTabs ?? ""} items={tabs} />
  28. </div>
  29. <div className={styles.rightMenu}>
  30. <Button
  31. variant="ghost"
  32. size="sm"
  33. rounded
  34. beforeIcon={Lifebuoy}
  35. drawer={SupportDrawer}
  36. className={styles.supportButton ?? ""}
  37. >
  38. Support
  39. </Button>
  40. <SearchButton
  41. className={styles.outlineSearchButton ?? ""}
  42. variant="outline"
  43. >
  44. <SearchShortcutText />
  45. </SearchButton>
  46. <SearchButton
  47. className={styles.ghostSearchButton ?? ""}
  48. hideText
  49. variant="ghost"
  50. >
  51. Search
  52. </SearchButton>
  53. <MobileMenu className={styles.mobileMenu} />
  54. <Button
  55. href="https://docs.pyth.network"
  56. size="sm"
  57. rounded
  58. target="_blank"
  59. className={styles.mainCta ?? ""}
  60. >
  61. Dev Docs
  62. </Button>
  63. <ThemeSwitch className={styles.themeSwitch ?? ""} />
  64. </div>
  65. </div>
  66. </header>
  67. );