Skip to content

Commit

Permalink
feat: optimize
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jun 21, 2023
1 parent 5abb757 commit e13dd8c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/common/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export const CodeBlock = (props: {
return <HighLighter {...props} />
}
}

export default CodeBlock
4 changes: 3 additions & 1 deletion src/components/ui/markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { Fragment, memo, useMemo, useRef } from 'react'
import { clsx } from 'clsx'
import { compiler, sanitizeUrl } from 'markdown-to-jsx'
import dynamic from 'next/dynamic'
import type { MarkdownToJSX } from 'markdown-to-jsx'
import type { FC, PropsWithChildren } from 'react'

Expand All @@ -24,7 +25,8 @@ import { MParagraph, MTableBody, MTableHead, MTableRow } from './renderers'
import { MDetails } from './renderers/collapse'
import { MFootNote } from './renderers/footnotes'
import { MLink } from './renderers/link'
import { CodeBlock } from '~/components/common/CodeBlock'

const CodeBlock = dynamic(() => import('~/components/common/CodeBlock'))

export interface MdProps {
value?: string
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/markdown/renderers/LinkRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useMemo } from 'react'
import dynamic from 'next/dynamic'

import { LinkCard } from '../../link-card'
import { MLink } from './link'
import { Tweet } from './paragraph'

const Tweet = dynamic(() => import('~/components/common/Tweet'))
export const LinkRenderer = ({ href }: { href: string }) => {
const url = useMemo(() => {
try {
Expand Down
2 changes: 0 additions & 2 deletions src/components/ui/markdown/renderers/paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from 'react'
import clsx from 'clsx'
import dynamic from 'next/dynamic'
import type { DetailedHTMLProps, FC, HTMLAttributes } from 'react'

import { LinkRenderer } from './LinkRenderer'

export const Tweet = dynamic(() => import('~/components/common/Tweet'))
export const MParagraph: FC<
DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>
> = (props) => {
Expand Down

1 comment on commit e13dd8c

@vercel
Copy link

@vercel vercel bot commented on e13dd8c Jun 21, 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:

springtide – ./

springtide-innei.vercel.app
springtide.vercel.app
springtide-git-main-innei.vercel.app
innei.in

Please sign in to comment.