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