feat: lazy load for page components
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
|
||||
export const Style: React.FC<{
|
||||
const Style: React.FC<{
|
||||
content?: string
|
||||
children?: React.ReactNode[]
|
||||
}> = ({ content, children }) => {
|
||||
@@ -22,3 +22,5 @@ export const Style: React.FC<{
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default Style
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { APlayer as AplayerReact } from "aplayer-react"
|
||||
import "aplayer-react/dist/index.css"
|
||||
import { memo } from "react"
|
||||
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
|
||||
export const APlayer: React.FC<
|
||||
const APlayer: React.FC<
|
||||
{
|
||||
name?: string
|
||||
artist?: string
|
||||
@@ -45,3 +46,5 @@ export const APlayer: React.FC<
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
||||
export default APlayer
|
||||
|
||||
@@ -151,7 +151,7 @@ export const Image: React.FC<TImageProps> = ({
|
||||
)
|
||||
}
|
||||
|
||||
export const ZoomedImage: React.FC<TImageProps> = (props) => {
|
||||
const ZoomedImage: React.FC<TImageProps> = (props) => {
|
||||
return (
|
||||
<span className="text-center block">
|
||||
{/* eslint-disable-next-line jsx-a11y/alt-text */}
|
||||
@@ -159,3 +159,5 @@ export const ZoomedImage: React.FC<TImageProps> = (props) => {
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
export default ZoomedImage
|
||||
|
||||
@@ -18,7 +18,7 @@ const getSiteId = ({ id, children }: { id: string; children?: any }) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const Mention: React.FC<{
|
||||
const Mention: React.FC<{
|
||||
id: string
|
||||
children?: any
|
||||
}> = memo(
|
||||
@@ -48,3 +48,5 @@ export const Mention: React.FC<{
|
||||
return getSiteId(prevProps) === getSiteId(nextProps)
|
||||
},
|
||||
)
|
||||
|
||||
export default Mention
|
||||
|
||||
@@ -6,9 +6,9 @@ import { FC, memo, useEffect, useState } from "react"
|
||||
import { useIsDark } from "~/hooks/useDarkMode"
|
||||
import { useIsUnmounted } from "~/hooks/useLifecycle"
|
||||
|
||||
import { ZoomedImage } from "./Image"
|
||||
import ZoomedImage from "./Image"
|
||||
|
||||
export const Mermaid: FC<{
|
||||
const Mermaid: FC<{
|
||||
children: [string]
|
||||
}> = memo(
|
||||
function Mermaid(props) {
|
||||
@@ -95,3 +95,5 @@ export const Mermaid: FC<{
|
||||
return prevProps.children?.[0] === nextProps.children?.[0]
|
||||
},
|
||||
)
|
||||
|
||||
export default Mermaid
|
||||
|
||||
@@ -7,6 +7,6 @@ const components: TweetComponents = {
|
||||
MediaImg: (props) => <Image {...props} fill unoptimized />,
|
||||
}
|
||||
|
||||
export function Tweet({ id }: { id: string }) {
|
||||
export default function Tweet({ id }: { id: string }) {
|
||||
return <ReactTweet id={id} components={components} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user