|
| 1 | +import { CaretRight } from "@phosphor-icons/react/dist/ssr/CaretRight"; |
| 2 | +import { ShieldChevron } from "@phosphor-icons/react/dist/ssr/ShieldChevron"; |
| 3 | +import { Gavel } from "@phosphor-icons/react/dist/ssr/Gavel"; |
| 4 | +import { Coins } from "@phosphor-icons/react/dist/ssr/Coins"; |
| 5 | +import { Plug } from "@phosphor-icons/react/dist/ssr/Plug"; |
| 6 | +import { Code } from "@phosphor-icons/react/dist/ssr/Code"; |
| 7 | +import { BookOpenText } from "@phosphor-icons/react/dist/ssr/BookOpenText"; |
| 8 | +import type { ReactNode } from "react"; |
| 9 | +import { DrawerTrigger, Drawer } from "@pythnetwork/component-library/Drawer"; |
| 10 | +import { type Props as CardProps, Card } from "@pythnetwork/component-library/Card"; |
| 11 | +import type { Link as UnstyledLink } from "@pythnetwork/component-library/unstyled/Link"; |
| 12 | + |
| 13 | +import styles from "./support-drawer.module.scss"; |
| 14 | +import { socialLinks } from "./social-links"; |
| 15 | + |
| 16 | +type Props = { |
| 17 | + children: ReactNode; |
| 18 | +} |
| 19 | + |
| 20 | +export const SupportDrawer = ({ children }: Props) => ( |
| 21 | + <DrawerTrigger> |
| 22 | + {children} |
| 23 | + <Drawer title="Support" bodyClassName={styles.supportDrawer}> |
| 24 | + <LinkList |
| 25 | + title="Integration" |
| 26 | + links={[ |
| 27 | + { |
| 28 | + icon: <Plug />, |
| 29 | + title: "Connect directly with real-time market data", |
| 30 | + description: "Integrate the Pyth data feeds into your app", |
| 31 | + target: "_blank", |
| 32 | + href: "https://docs.pyth.network/price-feeds/use-real-time-data" |
| 33 | + }, |
| 34 | + { |
| 35 | + icon: <BookOpenText />, |
| 36 | + title: "Learn how to work with Pyth data", |
| 37 | + description: "Read the Pyth Network documentation", |
| 38 | + target: "_blank", |
| 39 | + href: "https://docs.pyth.network" |
| 40 | + }, |
| 41 | + { |
| 42 | + icon: <Code />, |
| 43 | + title: "Try out the APIs", |
| 44 | + description: "Use the Pyth Network API Reference to experience the Pyth APIs", |
| 45 | + target: "_blank", |
| 46 | + href: "https://api-reference.pyth.network" |
| 47 | + } |
| 48 | + ]} |
| 49 | + /> |
| 50 | + <LinkList |
| 51 | + title="$PYTH Token" |
| 52 | + links={[ |
| 53 | + { |
| 54 | + icon: <Coins />, |
| 55 | + title: "Tokenomics", |
| 56 | + description: "Learn about how the $PYTH token is structured and distributed", |
| 57 | + target: "_blank", |
| 58 | + href: "https://docs.pyth.network/home/pyth-token/pyth-distribution" |
| 59 | + }, |
| 60 | + { |
| 61 | + icon: <ShieldChevron />, |
| 62 | + title: "Oracle Integrity Staking (OIS) Guide", |
| 63 | + description: "Learn how to help secure the oracle and earn rewards", |
| 64 | + target: "_blank", |
| 65 | + href: "https://docs.pyth.network/home/oracle-integrity-staking" |
| 66 | + }, |
| 67 | + { |
| 68 | + icon: <Gavel />, |
| 69 | + title: "Pyth Governance Guide", |
| 70 | + description: "Gain voting power to help shape the future of DeFi by participating in governance", |
| 71 | + target: "_blank", |
| 72 | + href: "https://docs.pyth.network/home/pyth-token#staking-pyth-for-governance" |
| 73 | + } |
| 74 | + ]} |
| 75 | + /> |
| 76 | + <LinkList |
| 77 | + title="Community" |
| 78 | + links={socialLinks.map(({ icon: Icon, href, name }) => ({ |
| 79 | + href, target: "_blank", title: name, description: href, icon: <Icon /> |
| 80 | + }))} |
| 81 | + /> |
| 82 | + </Drawer> |
| 83 | + </DrawerTrigger> |
| 84 | +) |
| 85 | + |
| 86 | +type LinkListProps = { |
| 87 | + title: ReactNode; |
| 88 | + links: (Omit<CardProps<typeof UnstyledLink>, "title" | "icon" | "description"> & { |
| 89 | + title: ReactNode; |
| 90 | + icon: ReactNode; |
| 91 | + description?: ReactNode | undefined; |
| 92 | + })[]; |
| 93 | +} |
| 94 | + |
| 95 | +const LinkList = ({ title, links }: LinkListProps) => ( |
| 96 | + <div className={styles.linkList}> |
| 97 | + <h3 className={styles.title}>{title}</h3> |
| 98 | + <ul className={styles.items}> |
| 99 | + {links.map(({ title, icon, description, ...link }, i) => ( |
| 100 | + <Card key={i} {...link}> |
| 101 | + <div className={styles.link}> |
| 102 | + <div className={styles.icon}>{icon}</div> |
| 103 | + <h4 className={styles.header}>{title}</h4> |
| 104 | + {description && <p className={styles.description}>{description}</p>} |
| 105 | + <CaretRight className={styles.caret} /> |
| 106 | + </div> |
| 107 | + </Card> |
| 108 | + ))} |
| 109 | + </ul> |
| 110 | + </div> |
| 111 | +) |
0 commit comments