GitHubCorner.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import oc from "open-color";
  2. import React from "react";
  3. import { THEME } from "../../packages/excalidraw/constants";
  4. import { Theme } from "../../packages/excalidraw/element/types";
  5. // https://github.com/tholman/github-corners
  6. export const GitHubCorner = React.memo(
  7. ({ theme, dir }: { theme: Theme; dir: string }) => (
  8. <svg
  9. xmlns="http://www.w3.org/2000/svg"
  10. width="40"
  11. height="40"
  12. viewBox="0 0 250 250"
  13. className="rtl-mirror"
  14. style={{
  15. marginTop: "calc(var(--space-factor) * -1)",
  16. [dir === "rtl" ? "marginLeft" : "marginRight"]:
  17. "calc(var(--space-factor) * -1)",
  18. }}
  19. >
  20. <a
  21. href="https://github.com/excalidraw/excalidraw"
  22. target="_blank"
  23. rel="noopener noreferrer"
  24. aria-label="GitHub repository"
  25. >
  26. <path
  27. d="M0 0l115 115h15l12 27 108 108V0z"
  28. fill={theme === THEME.LIGHT ? oc.gray[6] : oc.gray[7]}
  29. />
  30. <path
  31. className="octo-arm"
  32. d="M128 109c-15-9-9-19-9-19 3-7 2-11 2-11-1-7 3-2 3-2 4 5 2 11 2 11-3 10 5 15 9 16"
  33. style={{ transformOrigin: "130px 106px" }}
  34. fill={theme === THEME.LIGHT ? oc.white : "var(--default-bg-color)"}
  35. />
  36. <path
  37. className="octo-body"
  38. d="M115 115s4 2 5 0l14-14c3-2 6-3 8-3-8-11-15-24 2-41 5-5 10-7 16-7 1-2 3-7 12-11 0 0 5 3 7 16 4 2 8 5 12 9s7 8 9 12c14 3 17 7 17 7-4 8-9 11-11 11 0 6-2 11-7 16-16 16-30 10-41 2 0 3-1 7-5 11l-12 11c-1 1 1 5 1 5z"
  39. fill={theme === THEME.LIGHT ? oc.white : "var(--default-bg-color)"}
  40. />
  41. </a>
  42. </svg>
  43. ),
  44. );