index.tsx 698 B

123456789101112131415161718192021222324252627
  1. import "server-only";
  2. import type { lookup as lookupPublisher } from "@pythnetwork/known-publishers";
  3. import styles from "./index.module.scss";
  4. type Props = {
  5. knownPublisher: NonNullable<ReturnType<typeof lookupPublisher>>;
  6. };
  7. export const PublisherIcon = ({ knownPublisher }: Props) => {
  8. if ("dark" in knownPublisher.icon) {
  9. const { dark: Dark, light: Light } = knownPublisher.icon;
  10. return (
  11. <>
  12. <Dark className={styles.darkIcon} />
  13. <Light className={styles.lightIcon} />
  14. </>
  15. );
  16. } else {
  17. const Icon =
  18. "color" in knownPublisher.icon
  19. ? knownPublisher.icon.color
  20. : knownPublisher.icon.monochrome;
  21. return <Icon />;
  22. }
  23. };