From 7a7ddf80fcc4499d7ad8df6088057bf6e57f0a9a Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Sun, 8 Oct 2023 16:54:49 -0500 Subject: [PATCH] refactor(home): move EmbedCodeDialog to its own file --- src/pages/Home/EmbedCodeDialog.tsx | 84 ++++++++++++++++++++++++++++++ src/pages/Home/Home.tsx | 70 +++---------------------- 2 files changed, 91 insertions(+), 63 deletions(-) create mode 100644 src/pages/Home/EmbedCodeDialog.tsx diff --git a/src/pages/Home/EmbedCodeDialog.tsx b/src/pages/Home/EmbedCodeDialog.tsx new file mode 100644 index 0000000..f351fa5 --- /dev/null +++ b/src/pages/Home/EmbedCodeDialog.tsx @@ -0,0 +1,84 @@ +import Button from '@mui/material/Button' +import Dialog from '@mui/material/Dialog' +import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' +import { materialDark } from 'react-syntax-highlighter/dist/esm/styles/prism' +import DialogActions from '@mui/material/DialogActions' +import DialogContent from '@mui/material/DialogContent' +import DialogContentText from '@mui/material/DialogContentText' +import DialogTitle from '@mui/material/DialogTitle' +// These imports need to be ts-ignored to prevent spurious errors that look +// like this: +// +// Module 'react-markdown' cannot be imported using this construct. The +// specifier only resolves to an ES module, which cannot be imported +// synchronously. Use dynamic import instead. (tsserver 1471) +// +// @ts-ignore +import Markdown from 'react-markdown' +// @ts-ignore +import { CodeProps } from 'react-markdown/lib/ast-to-react' +// @ts-ignore +import remarkGfm from 'remark-gfm' + +interface EmbedCodeDialogProps { + showEmbedCode: boolean + handleEmbedCodeWindowClose: () => void + embedUrl: URL +} + +export const EmbedCodeDialog = ({ + showEmbedCode, + handleEmbedCodeWindowClose, + embedUrl, +}: EmbedCodeDialogProps) => ( + + Room embed code + + + ) + }, + }} + > + {`\`\`\`html +