mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
update lazy import
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
import rehypePrism from '@mapbox/rehype-prism';
|
import rehypePrism from '@mapbox/rehype-prism';
|
||||||
import components from 'components/mdx/components';
|
import components from 'components/mdx/components';
|
||||||
import PostToc from 'components/post/post-toc';
|
|
||||||
import data from 'content/mdx-data';
|
import data from 'content/mdx-data';
|
||||||
import { readSinglePost, allPostsPath } from 'lib/posts';
|
import { allPostsPath, readSinglePost } from 'lib/posts';
|
||||||
import { SingleToc, generateToc } from 'lib/utils';
|
import { SingleToc, generateToc } from 'lib/utils';
|
||||||
import { compileMDX } from 'next-mdx-remote/rsc';
|
import { compileMDX } from 'next-mdx-remote/rsc';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
@ -11,6 +10,7 @@ import rehypeSlug from 'rehype-slug';
|
|||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
import { Post } from 'types';
|
import { Post } from 'types';
|
||||||
|
|
||||||
|
const PostToc = dynamic(() => import('components/post/post-toc'));
|
||||||
const PostCommnetLine = dynamic(
|
const PostCommnetLine = dynamic(
|
||||||
() => import('components/post/post-commnet-line')
|
() => import('components/post/post-commnet-line')
|
||||||
);
|
);
|
||||||
|
@ -31,20 +31,20 @@ const PostToc = ({ toc, tocLength }: Props) => {
|
|||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
styles.head,
|
styles.head,
|
||||||
'bg-white pt-4 px-6',
|
'bg-white pt-4 px-4 md:px-6',
|
||||||
'rounded-lg border border-gray-200',
|
'rounded-lg',
|
||||||
'dark:bg-rua-gray-800 dark:border-rua-gray-600',
|
'dark:bg-rua-gray-800 dark:border-rua-gray-600',
|
||||||
'select-none cursor-pointer',
|
'select-none cursor-pointer',
|
||||||
'rounded-lg transition-all',
|
'rounded-lg transition-all',
|
||||||
'duration-500 overflow-hidden',
|
'duration-500 overflow-hidden',
|
||||||
'my-4 text-2xl'
|
'my-4 text-xl'
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
maxHeight: show ? (tocLength ?? 0) * 50 + 70 : 70,
|
maxHeight: show ? (tocLength ?? 0) * 50 + 60 : 60,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={clsx('flex justify-between items-center')}
|
className={clsx('flex justify-between items-center h-full')}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
<span className="text-gray-500">TABLE OF CONTENTS</span>
|
<span className="text-gray-500">TABLE OF CONTENTS</span>
|
||||||
|
Reference in New Issue
Block a user