index.tsx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import Link from "next/link";
  2. import type { ElementType, SVGProps } from "react";
  3. import Benchmarks from "./benchmarks.svg";
  4. import Entropy from "./entropy.svg";
  5. import PriceFeeds from "./price-feeds.svg";
  6. import { Button } from "../Button";
  7. import { MaxWidth } from "../MaxWidth";
  8. export const Home = () => (
  9. <main className="grid size-full place-content-center py-16 text-center">
  10. <h1 className="mb-16 text-4xl font-semibold text-pythpurple-600 dark:text-pythpurple-400">
  11. Pyth Network API Reference
  12. </h1>
  13. <MaxWidth>
  14. <nav
  15. className="flex flex-col items-stretch justify-center gap-12"
  16. aria-label="Products"
  17. >
  18. <ul className="contents">
  19. <li className="contents">
  20. <ProductLink
  21. icon={PriceFeeds}
  22. href="/price-feeds/evm/getPriceNoOlderThan"
  23. name="Price Feeds"
  24. >
  25. Fetch real-time low-latency market data, on 50+ chains or off
  26. chain
  27. </ProductLink>
  28. </li>
  29. <li className="contents">
  30. <ProductLink
  31. icon={Benchmarks}
  32. href="https://benchmarks.pyth.network/docs#/"
  33. target="_blank"
  34. name="Benchmarks"
  35. >
  36. Get historical market data from any Pyth feed for use in both on-
  37. and off-chain applications
  38. </ProductLink>
  39. </li>
  40. <li className="contents">
  41. <ProductLink icon={Entropy} href="/entropy" name="Entropy">
  42. Quickly and easily generate secure random numbers on the
  43. blockchain
  44. </ProductLink>
  45. </li>
  46. </ul>
  47. </nav>
  48. </MaxWidth>
  49. </main>
  50. );
  51. type ProductLinkProps = {
  52. name: string;
  53. href: string;
  54. target?: "_blank" | "_self";
  55. children: string;
  56. icon: ElementType<SVGProps<SVGSVGElement>>;
  57. };
  58. const ProductLink = ({
  59. name,
  60. children,
  61. href,
  62. target,
  63. icon: Icon,
  64. }: ProductLinkProps) => (
  65. <Button
  66. as={Link}
  67. href={href}
  68. target={target}
  69. gradient
  70. className="flex max-w-2xl flex-col items-center gap-2 p-6 text-center sm:flex-row sm:gap-6 sm:pr-12 sm:text-left"
  71. >
  72. <Icon className="h-24 p-3 text-pythpurple-600 dark:text-pythpurple-400" />
  73. <div className="flex flex-col gap-2">
  74. <h2 className="text-2xl font-medium text-pythpurple-600 dark:text-pythpurple-400">
  75. {name}
  76. </h2>
  77. <p className="text-lg font-normal text-neutral-600 dark:text-neutral-400">
  78. {children}
  79. </p>
  80. </div>
  81. </Button>
  82. );