Add link to GitHub repo in playground header
ghstack-source-id: 9fd0c2f8d70f8782602b0e4f8535b6be3ed89782 Pull Request resolved: https://github.com/facebook/react-forget/pull/2838
Lauren Tan committed
Apr 10, 2024 at 18:17 UTC
7083231f6d872d126fa2c2cb7cec386c02cc51a9
2 files changed
+36
compiler/apps/playground/components/Header.tsx
+11
@@ -8,9 +8,11 @@
8
import { RefreshIcon, ShareIcon } from "@heroicons/react/outline";
9
import { CheckIcon } from "@heroicons/react/solid";
10
import clsx from "clsx";
11
+import Link from "next/link";
12
import { useSnackbar } from "notistack";
13
import { useState } from "react";
14
import { defaultStore } from "../lib/defaultStore";
15
+import { IconGitHub } from "./Icons/IconGitHub";
16
import Logo from "./Logo";
17
import { useStoreDispatch } from "./StoreContext";
18
@@ -75,6 +77,15 @@ export default function Header() {
77
)}
78
<p className="hidden sm:block">Share</p>
79
</button>
80
+ <Link
81
+ href="https://github.com/facebook/react"
82
+ target="_blank"
83
+ rel="noreferrer noopener"
84
+ aria-label="Open on GitHub"
85
+ className="flex items-center gap-1 transition-colors duration-150 ease-in text-secondary hover:text-link"
86
+ >
87
+ <IconGitHub />
88
+ </Link>
89
</div>
90
</div>
91
);
compiler/apps/playground/components/Icons/IconGitHub.tsx
new
+25
@@ -0,0 +1,25 @@
1
+/**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+import { memo } from "react";
9
+
10
+export const IconGitHub = memo<JSX.IntrinsicElements["svg"]>(
11
+ function IconGitHub(props) {
12
+ return (
13
+ <svg
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ width="1.5em"
16
+ height="1.5em"
17
+ viewBox="0 -2 24 24"
18
+ fill="currentColor"
19
+ {...props}
20
+ >
21
+ <path d="M10 0a10 10 0 0 0-3.16 19.49c.5.1.68-.22.68-.48l-.01-1.7c-2.78.6-3.37-1.34-3.37-1.34-.46-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.52 2.34 1.08 2.91.83.1-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.1.39-1.99 1.03-2.69a3.6 3.6 0 0 1 .1-2.64s.84-.27 2.75 1.02a9.58 9.58 0 0 1 5 0c1.91-1.3 2.75-1.02 2.75-1.02.55 1.37.2 2.4.1 2.64.64.7 1.03 1.6 1.03 2.69 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85l-.01 2.75c0 .26.18.58.69.48A10 10 0 0 0 10 0"></path>
22
+ </svg>
23
+ );
24
+ },
25
+);