build React.

This commit is contained in:
tangly1024.com
2023-11-06 14:20:43 +08:00
parent 0a6c59ed7b
commit ecf7825dad
117 changed files with 121 additions and 206 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react'
import Link from 'next/link'
import BLOG from '@/blog.config'
/**
* 博客归档列表
* @param posts 所有文章

View File

@@ -2,7 +2,6 @@ import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import Image from 'next/image'
import Link from 'next/link'
import React from 'react'
import Card from './Card'
import TagItemMini from './TagItemMini'
import CONFIG from '../config'

View File

@@ -3,7 +3,7 @@ import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import throttle from 'lodash.throttle'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) return <></>

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { useGlobal } from '@/lib/global'
const CategoryList = ({ currentCategory, categoryOptions }) => {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import throttle from 'lodash.throttle'
import DarkModeButton from './DarkModeButton'

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { siteConfig } from '@/lib/config'
const Logo = props => {

View File

@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'
import BLOG from '@/blog.config'
import Link from 'next/link'
import { RecentComments } from '@waline/client'
@@ -9,9 +9,9 @@ import { RecentComments } from '@waline/client'
* @returns
*/
const NextRecentComments = (props) => {
const [comments, updateComments] = React.useState([])
const [onLoading, changeLoading] = React.useState(true)
React.useEffect(() => {
const [comments, updateComments] = useState([])
const [onLoading, changeLoading] = useState(true)
useEffect(() => {
RecentComments({
serverURL: BLOG.COMMENT_WALINE_SERVER_URL,
count: 5

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { isBrowser } from '@/lib/utils'
/**

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
@@ -7,10 +6,10 @@ import CONFIG from '../config'
* 展示文章推荐
*/
const RecommendPosts = ({ recommendPosts }) => {
const { locale } = useGlobal()
if (!CONFIG.ARTICLE_RELATE_POSTS || !recommendPosts || recommendPosts.length < 1) {
return <></>
}
const { locale } = useGlobal()
return (
<div className="pt-2 border pl-4 py-2 my-4 dark:text-gray-300 ">

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Image from 'next/image'
/**

View File

@@ -3,7 +3,6 @@ import { MenuList } from './MenuList'
import SearchInput from './SearchInput'
import Toc from './Toc'
import { useGlobal } from '@/lib/global'
import React from 'react'
import Tabs from '@/components/Tabs'
import Logo from './Logo'
import Card from './Card'

View File

@@ -1,6 +1,5 @@
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import React from 'react'
import Card from './Card'
import CategoryGroup from './CategoryGroup'
import TagGroups from './TagGroups'

View File

@@ -3,7 +3,6 @@ import InfoCard from './InfoCard'
import TagGroups from './TagGroups'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import React from 'react'
/**
* 侧边栏

View File

@@ -1,6 +1,6 @@
import SideBar from './SideBar'
import { useRouter } from 'next/router'
import React, { useEffect, useImperativeHandle } from 'react'
import { useEffect, useImperativeHandle } from 'react'
/**
* 侧边栏抽屉面板,可以从侧面拉出

View File

@@ -1,5 +1,4 @@
import Link from 'next/link'
import React from 'react'
import { useGlobal } from '@/lib/global'
const TagItem = ({ tag, selected }) => {

View File

@@ -1,5 +1,5 @@
import React from 'react'
import TagItem from './TagItem'
/**
* 横向的标签列表
* @param tags

View File

@@ -1,8 +1,7 @@
import React, { useRef } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import throttle from 'lodash.throttle'
import { uuidToId } from 'notion-utils'
import Progress from './Progress'
// import { cs } from 'react-notion-x'
/**
* 目录导航组件
@@ -12,7 +11,7 @@ import Progress from './Progress'
*/
const Toc = ({ toc }) => {
// 监听滚动事件
React.useEffect(() => {
useEffect(() => {
window.addEventListener('scroll', actionSectionScrollSpy)
actionSectionScrollSpy()
return () => {
@@ -25,9 +24,9 @@ const Toc = ({ toc }) => {
const tocIds = []
// 同步选中目录事件
const [activeSection, setActiveSection] = React.useState(null)
const [activeSection, setActiveSection] = useState(null)
const throttleMs = 200
const actionSectionScrollSpy = React.useCallback(throttle(() => {
const actionSectionScrollSpy = useCallback(throttle(() => {
const sections = document.getElementsByClassName('notion-h')
let prevBBox = null
let currentSectionId = activeSection

View File

@@ -1,5 +1,5 @@
import Toc from './Toc'
import React, { useImperativeHandle, useState } from 'react'
import { useImperativeHandle, useState } from 'react'
import { useGlobal } from '@/lib/global'
/**

View File

@@ -1,5 +1,4 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG from '../config'
/**