/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import {RefreshIcon, ShareIcon} from '@heroicons/react/outline'; import {CheckIcon} from '@heroicons/react/solid'; import clsx from 'clsx'; import Link from 'next/link'; import {useSnackbar} from 'notistack'; import { useState, startTransition, unstable_addTransitionType as addTransitionType, } from 'react'; import {defaultStore} from '../lib/defaultStore'; import {IconGitHub} from './Icons/IconGitHub'; import Logo from './Logo'; import {useStore, useStoreDispatch} from './StoreContext'; import {TOGGLE_INTERNALS_TRANSITION} from '../lib/transitionTypes'; export default function Header(): JSX.Element { const [showCheck, setShowCheck] = useState(false); const store = useStore(); const dispatchStore = useStoreDispatch(); const {enqueueSnackbar, closeSnackbar} = useSnackbar(); const handleReset: () => void = () => { if (confirm('Are you sure you want to reset the playground?')) { /** * Close open snackbars if any. This is necessary because when displaying * outputs (Preview or not), we only close previous snackbars if we received * new messages, which is needed in order to display "Bad URL" or success * messages when loading Playground for the first time. Otherwise, messages * such as "Bad URL" will be closed by the outputs calling `closeSnackbar`. */ closeSnackbar(); dispatchStore({type: 'setStore', payload: {store: defaultStore}}); } }; const handleShare: () => void = () => { navigator.clipboard.writeText(location.href).then(() => { enqueueSnackbar('URL copied to clipboard'); setShowCheck(true); // Show the check mark icon briefly after URL is copied setTimeout(() => setShowCheck(false), 1000); }); }; return (

React Compiler Playground

Show Internals
); }