Skip to content

Commit

Permalink
feat(syntax-hightlighting): lazy load language files
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Oct 11, 2023
1 parent d3630e0 commit ff988d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/Message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Box from '@mui/material/Box'
import Tooltip from '@mui/material/Tooltip'
import Typography, { TypographyProps } from '@mui/material/Typography'
import Link, { LinkProps } from '@mui/material/Link'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import { materialDark } from 'react-syntax-highlighter/dist/esm/styles/prism'

// These imports need to be ts-ignored to prevent spurious errors that look
Expand All @@ -29,6 +28,8 @@ import {
} from 'models/chat'
import { PeerNameDisplay } from 'components/PeerNameDisplay'

import { SyntaxHighlighter } from '../../components/SyntaxHighlighter'

import { InlineMedia } from './InlineMedia'
import './Message.sass'

Expand Down
3 changes: 3 additions & 0 deletions src/components/SyntaxHighlighter/SyntaxHighlighter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter'

export { SyntaxHighlighter }
1 change: 1 addition & 0 deletions src/components/SyntaxHighlighter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './SyntaxHighlighter'
3 changes: 2 additions & 1 deletion src/pages/Home/EmbedCodeDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
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'

import { SyntaxHighlighter } from '../../components/SyntaxHighlighter'

interface EmbedCodeDialogProps {
showEmbedCode: boolean
handleEmbedCodeWindowClose: () => void
Expand Down

1 comment on commit ff988d9

@vercel
Copy link

@vercel vercel bot commented on ff988d9 Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chitchatter – ./

chitchatter-jeremyckahn.vercel.app
chitchatter.vercel.app
chitchatter-git-main-jeremyckahn.vercel.app

Please sign in to comment.